NAME

Mac::SleepEvent - run Perl code on Mac OS X sleep and wake events

SYNOPSIS

use Mac::SleepEvent;
my $sn = Mac::SleepEvent->new(
 wake   => sub {print "Waking up...\n"},
 sleep  => sub {print "Going to sleep\n"},
 logout => sub {exit(0)},
);
$sn->listen;

DESCRIPTION

Mac::SleepEvent provides callbacks to run code when Mac OS X goes to sleep, wakes up, or logs out (same as shutdown). When the listen method is called, the program will enter a run loop, awaiting events from the OS.

CAVEATS

Mac::SleepEvent requires the Foundation module, which is only included with the OS X system perl.

METHODS

listen

This will start the run loop.

AUTHORS

Lee Aylward <leedo@cpan.org>

COPYRIGHT

Copyright 2009 Lee Aylward.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 38:

'=item' outside of any '=over'

Around line 42:

You forgot a '=back' before '=head1'