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

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;

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.

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

This will start the run loop.

Lee Aylward <leedo@cpan.org>

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