AnyEvent

 view release on metacpan or  search on metacpan

lib/AnyEvent/Impl/Glib.pm  view on Meta::CPAN


   bless \\$source, $class
}

sub timer {
   my ($class, %arg) = @_;
   
   my $cb   = $arg{cb};
   my $ival = $arg{interval} * 1000;

   my $source; $source = add Glib::Timeout $arg{after} < 0 ? 0 : $arg{after} * 1000,
      $ival ? sub {
                remove Glib::Source $source;
                $source = add Glib::Timeout $ival, sub { &$cb; 1 };
                &$cb;
                1 # already removed, should be a nop
              }
            : sub {
               # due to the braindamaged libglib API (it manages
               # removed-but-active watchers internally, but forces
               # users to # manage the same externally as well),
               # we have to go through these contortions.
               remove Glib::Source $source;
               undef $source;

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.489 second using v1.00-cache-2.02-grep-82fe00e-cpan-cec75d87357c )