line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Acme::Meow; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
53817
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
70
|
|
4
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
92
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
require Exporter; |
7
|
2
|
|
|
2
|
|
11
|
use base qw[ Exporter ]; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
1329
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Acme::Meow - It's the kitty you've always wanted |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Version 0.01 - please note this is a preview release, the API may change |
15
|
|
|
|
|
|
|
$Id: Meow.pm 558 2007-09-07 12:14:11Z f00li5h $ |
16
|
|
|
|
|
|
|
=cut |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
19
|
|
|
|
|
|
|
=head1 SYNOPSIS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
This module is intended for use by folks who's leases |
22
|
|
|
|
|
|
|
specify that they are not allowed to have any pets |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
use Acme::Meow; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my $kitty = Acme::Meow->new(); |
27
|
|
|
|
|
|
|
$kitty->pet(); |
28
|
|
|
|
|
|
|
$kitty->feed(); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 FUNCTIONS |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head2 new - kitty constructor |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Currently only abstract kitties are available so no options are available, |
36
|
|
|
|
|
|
|
although they may be added in the future. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
This method will take a hashref of options as required. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub new { |
43
|
1
|
|
|
1
|
1
|
14
|
bless{},shift |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 METHODS |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 pet - pet the kitty |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=cut |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
our @snacks = qw[ milk nip ]; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub pet { |
55
|
0
|
|
|
0
|
1
|
|
my($kitty) =@_; |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
my @reactions = qw[ purr nuzzle meow ]; |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
$kitty->{'<3'} ++; |
60
|
0
|
|
|
|
|
|
$kitty->{'favs'} = { |
61
|
|
|
|
|
|
|
snack => @snacks[ rand @snacks ] |
62
|
|
|
|
|
|
|
}; |
63
|
|
|
|
|
|
|
|
64
|
0
|
0
|
|
|
|
|
print $kitty->_kitty_status, |
65
|
|
|
|
|
|
|
$reactions[ rand @reactions ], $kitty->{'<3'} > 15 ? '<3' : '' |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 feed - give the kitty a snack |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
the kitty does need to eat, otherwise it will get unhealthy |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=cut |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub feed { |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
0
|
1
|
|
my($kitty) =@_; |
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
my @reactions = ( 'crunch', 'lap lap', ''); |
82
|
|
|
|
|
|
|
|
83
|
0
|
0
|
|
|
|
|
if (!$kitty->is_sleeping()){ |
84
|
0
|
|
|
|
|
|
$kitty->{'^_^'} ++; |
85
|
0
|
|
|
|
|
|
$kitty->{'<3' } += 0.5; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
else { |
88
|
0
|
|
|
|
|
|
$kitty->{'^_^'} -= 0.5; |
89
|
0
|
|
|
|
|
|
$kitty->{'<3' } += 0.25; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
0
|
|
|
|
|
|
print $kitty->_kitty_status, |
93
|
|
|
|
|
|
|
$reactions[ rand @reactions ]; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 EXPORTS |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
by default this package exports some methods for playing with your |
100
|
|
|
|
|
|
|
kitties. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head2 milk - give milk to a kitty. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
if not called directly on a kitty, $_ will be checked for a kitty; |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=cut |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
our @EXPORT = qw(&milk &nip); # afunc is a function |
109
|
|
|
|
|
|
|
# @EXPORT_OK = qw(&%hash *typeglob); # explicit prefix on &bfunc |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub milk { |
112
|
0
|
|
|
0
|
1
|
|
my $kitty; |
113
|
|
|
|
|
|
|
|
114
|
0
|
0
|
0
|
|
|
|
if(not @_ and ref $_ eq __PACKAGE__){ |
115
|
0
|
|
|
|
|
|
$kitty = $_ |
116
|
|
|
|
|
|
|
} |
117
|
0
|
0
|
|
|
|
|
if( @_ ){ $kitty = shift } |
|
0
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
119
|
0
|
|
|
|
|
|
$kitty->feed( 'milk' ); |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head2 nip - give nip to a kitty. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
if not called directly on a kitty, $_ will be checked for a kitty; |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=cut |
127
|
|
|
|
|
|
|
sub nip { |
128
|
|
|
|
|
|
|
|
129
|
0
|
|
|
0
|
1
|
|
my $kitty; |
130
|
|
|
|
|
|
|
|
131
|
0
|
0
|
0
|
|
|
|
if(not @_ and ref $_ eq __PACKAGE__){ |
132
|
0
|
|
|
|
|
|
$kitty = $_ |
133
|
|
|
|
|
|
|
} |
134
|
0
|
0
|
|
|
|
|
if( @_ ){ $kitty = shift } |
|
0
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
|
136
|
0
|
|
|
|
|
|
$kitty->feed( 'nip' ); |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head2 is_sleeping |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
This method will tell you if your kitty is having a cat nap. |
144
|
|
|
|
|
|
|
Kittens may be very cranky during their nap time, and waking them may be a bad |
145
|
|
|
|
|
|
|
idea. |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=cut |
148
|
|
|
|
|
|
|
sub is_sleeping { |
149
|
|
|
|
|
|
|
|
150
|
0
|
|
|
0
|
1
|
|
my($kitty) =@_; |
151
|
0
|
|
|
|
|
|
0; #TODO: our kitties are currently insomniacs |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head2 _kitty_status |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
private |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=cut |
159
|
|
|
|
|
|
|
sub _kitty_status { |
160
|
|
|
|
|
|
|
|
161
|
0
|
|
|
0
|
|
|
my($kitty) =@_; |
162
|
0
|
0
|
|
|
|
|
return 'zZzZ' if $kitty->is_sleeping(); |
163
|
0
|
0
|
|
|
|
|
$kitty->{'<3'} > 5 ? '=-_-=' : '=^_^='; |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
} |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head1 AUTHOR |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
FOOLISH, C<< >> |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head1 BUGS |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
174
|
|
|
|
|
|
|
C, or through the web interface at |
175
|
|
|
|
|
|
|
L. |
176
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
177
|
|
|
|
|
|
|
your bug as I make changes. |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head1 TODO |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=over 4 |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=item play |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
it'd be nince to play games with the kitty too |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
$kitty->play( 'game' ); |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=back |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=head1 SUPPORT |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
perldoc Acme::Meow |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
You can also look for information at: |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=over 4 |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
L |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=item * CPAN Ratings |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
L |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
L |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=item * Search CPAN |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
L |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=back |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
Copyright 2007 FOOLISH, all rights reserved. |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
226
|
|
|
|
|
|
|
under the same terms as Perl itself. |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=cut |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
1; # End of Acme::Meow |