line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Event::ScreenSaver; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Created on: 2009-07-10 19:40:40 |
4
|
|
|
|
|
|
|
# Create by: Ivan Wills |
5
|
|
|
|
|
|
|
# $Id$ |
6
|
|
|
|
|
|
|
# $Revision$, $HeadURL$, $Date$ |
7
|
|
|
|
|
|
|
# $Revision$, $Source$, $Date$ |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
20605
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use warnings; |
11
|
|
|
|
|
|
|
use version; |
12
|
|
|
|
|
|
|
use English qw/ -no_match_vars /; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = version->new('0.0.6'); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my %module = ( |
17
|
|
|
|
|
|
|
linux => 'Unix', |
18
|
|
|
|
|
|
|
solaris => 'Unix', |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $module = $module{$OSNAME} || $OSNAME; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
extends "Event::ScreenSaver::$module"; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
1; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
__END__ |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 NAME |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Event::ScreenSaver - Provides the ability to hook functions to the starting |
32
|
|
|
|
|
|
|
and stopping of the screen saver (Linux only at the moment) |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 VERSION |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
This documentation refers to Event::ScreenSaver version 0.0.6. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 SYNOPSIS |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
use Event::ScreenSaver; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# create the screen saver object |
43
|
|
|
|
|
|
|
my $ss = Event::ScreenSaver->new(); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# add functions to events |
46
|
|
|
|
|
|
|
$ss->start( sub {print "The screen saver started\n" } ); |
47
|
|
|
|
|
|
|
$ss->stop( sub { print "The screen saver stopped\n" } ); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# run the event handler |
50
|
|
|
|
|
|
|
$ss->run(); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# or more simply |
53
|
|
|
|
|
|
|
Event::ScreenSaver->new( |
54
|
|
|
|
|
|
|
start => sub {say "Screen saver started"}, |
55
|
|
|
|
|
|
|
stop => sub {say "Screen saver stopped"}, |
56
|
|
|
|
|
|
|
)->run; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 DESCRIPTION |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
This module will try to load the most appropriate class for monitoring the |
61
|
|
|
|
|
|
|
starting and stopping of the screen saver. Currently that means the Unix |
62
|
|
|
|
|
|
|
module os it probably wont work that broadly. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 Extending |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
The recommended method of implementing this for other operating systems is to |
67
|
|
|
|
|
|
|
extend L<Event::ScreenSaver::Unix> and over write the run method with an OS |
68
|
|
|
|
|
|
|
specific version. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 C<run ()> |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Starts the event loop monitoring the screen saver. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Note that this will never return you will need to implement some other |
77
|
|
|
|
|
|
|
exit strategy (like Ctrl-C). |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head2 C<start ( [$sub] )> |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Gets/Sets the start handler code. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 C<stop ( [$sub] )> |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Gets/Sets the stop handler code. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 DIAGNOSTICS |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 CONFIGURATION AND ENVIRONMENT |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 INCOMPATIBILITIES |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
This module is currently only tested on a Ubuntu Linux system it will |
98
|
|
|
|
|
|
|
probably work on other Desktop Linuxes and may work on other Unix systems |
99
|
|
|
|
|
|
|
but will probably not work on other operating systems. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
See L<Event::ScreenSaver> for its bugs and limitations. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Please report problems to Ivan Wills (ivan.wills@gmail.com). |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Patches are welcome (Particularly for other operating systems). |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Code can be found at L<http://github.com/ivanwills/Event-ScreenSaver/tree/master> |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 AUTHOR |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Ivan Wills - (ivan.wills@gmail.com) |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Copyright (c) 2009 Ivan Wills (14 Mullion Close, Hornsby Heights, NSW Australia 2077). |
116
|
|
|
|
|
|
|
All rights reserved. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or modify it under |
119
|
|
|
|
|
|
|
the same terms as Perl itself. See L<perlartistic>. This program is |
120
|
|
|
|
|
|
|
distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
121
|
|
|
|
|
|
|
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
122
|
|
|
|
|
|
|
PARTICULAR PURPOSE. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=cut |