Sponsored Content
Full Discussion: Need AnyEvent help
Top Forums Shell Programming and Scripting Need AnyEvent help Post 302491157 by Corona688 on Wednesday 26th of January 2011 08:06:27 PM
Old 01-26-2011
It'd be helpful to tell people this is perl.

Most forum regulars probably haven't even heard of this module either, let alone used it or had it installed. I'll see if I can find it in my distro.

---------- Post updated at 07:06 PM ---------- Previous update was at 06:56 PM ----------

How about
Code:
#!/usr/bin/perl

use AnyEvent;

sub do_report() {
  print "Inside do_report\n";
}

my $loop = AnyEvent->condvar;


my $report = AnyEvent->timer(
        after => 3,
        interval => 3,
        cb => sub {
                do_report();
        }
);

$w = AnyEvent->idle (cb => sub { print "idle\n"; sleep 1; } );

$loop->recv;

exit 0;

This User Gave Thanks to Corona688 For This Post:
 
AnyEvent::Serialize(3pm)				User Contributed Perl Documentation				  AnyEvent::Serialize(3pm)

NAME
AnyEvent::Serialize - async serialize/deserialize function SYNOPSIS
use AnyEvent::Serialize ':all'; use AnyEvent::Serialize 'serialize'; use AnyEvent::Serialize 'deserialize'; use AnyEvent::Serialize ... block_size => 666; serialize $object, sub { ($str, $recursion_detected) = @_ }; deserialize $string, sub { my ($object, $error, $tail) = @_ } DESCRIPTION
Sometimes You need to serialize/deserialize a lot of data. If You do it using Data::Dumper or eval it can take You too much time. This module splits (de)serialization process into fixed-size parts and does this work in non-blocking mode. This module uses Data::StreamSerializer and Data::StreamDeserializer to serialize or deserialize Your data. EXPORT
serialize($object, $result_callback) Serializes Your object. When serialization is done it will call $result_callback. This callback receives two arguments: result string flag if recursion is detected deserialize($str, $result_callback) Deserializes Your string. When deserialization is done or an error is detected it will call $result_callback. This callback receives three arguments: deserialized object error string (if an error was occured) undeserialized string tail BREAKING
You can break serialization/deserialization process if You save value that is returned by functions serialize/deserialize. They return guards if they are called in non-void context. SEE ALSO
Data::StreamSerializer, Data::StreamDeserializer. AUTHOR
Dmitry E. Oboukhov, <unera@debian.org> COPYRIGHT AND LICENSE
Copyright (C) 2011 by Dmitry E. Oboukhov This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.1 or, at your option, any later version of Perl 5 you may have available. perl v5.10.1 2011-03-02 AnyEvent::Serialize(3pm)
All times are GMT -4. The time now is 07:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy