/usr/lib/perl5/pods/SDL/Time.pod is in libsdl-perl 2.540-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | =pod
=head1 NAME
SDL::Time - An SDL Perl extension for managing timers
=head1 CATEGORY
Core
=head1 SYNOPSIS
use warnings;
use strict;
use threads;
use threads::shared;
use SDL::Time;
package foo;
use SDL ':all';
SDL::init(SDL_INIT_TIMER);
my $tick :shared = 0;
sub ticker { $tick++; warn $tick; return 100; }
package main;
my $id = SDL::Time::add_timer(100, 'foo::ticker');
sleep(2);
SDL::Time::remove_timer($id);
=head1 METHODS
=head2 add_timer
my $id = SDL::Timer::add_timer( $ms_interval, $callback );
This runs in a separate thread and a cloned Perl thread.
C<threads> and C<threads::shared> must be used to share any variables the timer uses.
The C<$callback> function, specified with a string of the function's name, will be called after the milliseconds of C<$interval> have elapsed.
The actual delay may be longer than specified depending on the underlying OS.
The callback function is passed the current timer interval as well as the C<$interval> parameter and should return the next timer interval.
If the return value from the callback is 0, the timer is cancelled; otherwise, the timer will continue to run.
The timer callback function may run in a different thread to your main program, so it shouldn't call any functions from within itself.
You may call SDL::push_event, however.
C<SDL::Time::add_timer> returns the identifier value of the generated timer or undef on error.
B<Note:> You must initialize (C<SDL::init>) the timer subsystem to use this function.
=head2 remove_timer
SDL::Timer::remove_timer( $id );
The other way to cancel a timer is to use C<SDL::Time::remove_timer> on the C<$id> of a timer.
This ID is the return value of the C<SDL::Time::add_timer> function.
C<SDL::Time::remove_timer> returns C<0> on success or C<-1> on error.
=head1 AUTHORS
See L<SDL/AUTHORS>.
=cut
|