File Coverage

blib/lib/Acme/Timecube.pm
Criterion Covered Total %
statement 15 29 51.7
branch 0 2 0.0
condition n/a
subroutine 5 8 62.5
pod 1 1 100.0
total 21 40 52.5


line stmt bran cond sub pod time code
1             package Acme::Timecube;
2              
3 1     1   27774 use HTML::TreeBuilder;
  1         40605  
  1         10  
4 1     1   1152 use LWP::UserAgent;
  1         122964  
  1         47  
5              
6 1     1   13 use strict;
  1         9  
  1         45  
7 1     1   6 use warnings;
  1         2  
  1         98  
8              
9             our $VERSION = '0.01';
10             our @METHODS = (['debate', 'discourse', 'discussion', 'dissertation', 'essay',
11             'exposition', 'lecture', 'preach', 'sermon', 'speech', 'treatise'],
12             [10, 8, 4, 18, 25, 7, 22, 1, 13, 9, 30]);
13              
14             {
15 1     1   5 no strict 'refs';
  1         3  
  1         612  
16             my $c = -1;
17              
18             foreach my $m (@{$METHODS[0]}) {
19             *{ __PACKAGE__.'::'.$m } = sub {
20 0     0     for ( 1 .. $METHODS[1][$c++] ) { $_[0]->__truth }
  0            
21             }
22             }
23             }
24              
25             sub new {
26 0     0 1   my $class = shift;
27 0           my $self = {};
28 0           bless $self, $class;
29 0           $self->{ua} = LWP::UserAgent->new;
30 0           $self->{wisdom} = HTML::TreeBuilder->new_from_content( $self->{ua}->get( 'http://www.timecube.com' )->decoded_content );
31 0 0         $self->{wisdom} or die "Couldn't fetch wisdom...\n";
32 0           @{ $self->{verses} } = $self->{wisdom}->find_by_tag_name( 'p' );
  0            
33 0           return $self
34             }
35              
36             sub __truth {
37 0     0     print @{ $_[0]->{verses} }[ int rand scalar @{ $_[0]->{verses} } ]->as_trimmed_text( extra_chars => '\xA0' )."\n"
  0            
  0            
38             }
39              
40             =head1 NAME
41              
42             Acme::Timecube - Installs 4 corner cubic wisdom.
43              
44             =head1 VERSION
45              
46             Version 0.01
47              
48             =head1 SYNOPSIS
49              
50             Quick summary of what the module does.
51              
52             Perhaps a little code snippet.
53              
54             use Acme::Timecube;
55              
56             my $tc = Acme::Timecube->new();
57              
58             # Preach cubic wisdom
59             $tc->preach;
60              
61             # Deliver a discourse on 4 corner day logic
62             $tc->discourse;
63              
64             # A lecture on why you are a stupid educated fool
65             $tc->lecture;
66              
67             =head1 METHODS
68              
69             =head2 new
70              
71             Creates a new L object.
72              
73             =head2 debate, discourse, discussion, dissertation, essay, exposition, lecture, preach, sermon, speech, treatise
74              
75             Deliver a debate, discourse, discussion, dissertation, essay, exposition, lecture, preach,
76             sermon, speech or treatise on Timecube philosophy and science.
77              
78             =head1 AUTHOR
79              
80             Luke Poskitt, C<< >>
81              
82             =head1 BUGS
83              
84             None. Acme::Timecube is free from your stupid, academic 1 day bugs.
85              
86             =head1 SUPPORT
87              
88             You can find documentation for this module with the perldoc command.
89              
90             perldoc Acme::Timecube
91              
92             You can also look for information at:
93              
94             =over 4
95              
96             =item * RT: CPAN's request tracker (report bugs here)
97              
98             L
99              
100             =item * AnnoCPAN: Annotated CPAN documentation
101              
102             L
103              
104             =item * CPAN Ratings
105              
106             L
107              
108             =item * Search CPAN
109              
110             L
111              
112             =back
113              
114             =head1 ACKNOWLEDGEMENTS
115              
116             Gene Ray - mad props
117              
118             =head1 LICENSE AND COPYRIGHT
119              
120             Copyright 2012 Luke Poskitt.
121              
122             This program is free software; you can redistribute it and/or modify it
123             under the terms of either: the GNU General Public License as published
124             by the Free Software Foundation; or the Artistic License.
125              
126             See http://dev.perl.org/licenses/ for more information.
127              
128             =cut
129              
130             1;