| 1 | package Acme::RandomQuote::Base; | ||
| 2 | |||
| 3 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 2 | ▶ | use File::RandomLine; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 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 | 2 | 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 | 0 | ▶ | sub new { |
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 37 | 0 | 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 | 0 | ▶ | sub get_random_quote { |
|
Subroutine
get_random_quote: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 51 | 0 | 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<< <dafneves at mangaru.net> >> | ||
| 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 | 2 | 1; # End of Acme::RandomQuote::Base | |