line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Acme::RandomQuote::Base; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
28226
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
30
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
795
|
use File::RandomLine; |
|
1
|
|
|
|
|
3859
|
|
|
1
|
|
|
|
|
139
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Acme::RandomQuote::Base - The great new Acme::RandomQuote::Base! |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Version 0.01 |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
use Acme::RandomQuote::Base; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $foo = Acme::RandomQuote::Base->new( 'file' ); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
print $foo->get_random_quote(); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head2 new |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Creates a new Acme::RandomQuote::Base object. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
my $foo = Acme::RandomQuote::Base->new( 'file' ); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=cut |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub new { |
37
|
0
|
|
|
0
|
1
|
|
my ( $self, $filename ) = @_; |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
return bless \$filename => $self; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 get_random_quote |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Returns a random line from the selected file. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
print $foo->get_random_quote(); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=cut |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub get_random_quote { |
51
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
my $rl = File::RandomLine->new( $$self ); |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
return $rl->next; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 AUTHOR |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Diogo Neves, C<< >> |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Copyright 2008 Diogo Neves, all rights reserved. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
67
|
|
|
|
|
|
|
under the same terms as Perl itself. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; # End of Acme::RandomQuote::Base |