line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::Comic::Plugin::f8d; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
51316
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
69
|
|
4
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
70
|
|
5
|
2
|
|
|
2
|
|
11
|
use Carp; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
178
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
11
|
use vars qw($VERSION @ISA %COMICS); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
840
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
9
|
|
|
|
|
|
|
@ISA = qw(WWW::Comic::Plugin); |
10
|
|
|
|
|
|
|
%COMICS = (f8d => 'f8d - minimalist and esoteric webcomic'); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# $Id: f8d.pm 733 2009-09-17 13:31:20Z davidp $ |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 NAME |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
WWW::Comic::Plugin::f8d - WWW::Comic plugin to fetch f8d comic |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 SYNOPSIS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
See L for full details, but here's a brief example: |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
use WWW::Comic; |
24
|
|
|
|
|
|
|
my $wc = new WWW::Comic; |
25
|
|
|
|
|
|
|
my $latest_candh_strip_url |
26
|
|
|
|
|
|
|
= WWW::Comic->strip_url(comic => 'f8d'); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 DESCRIPTION |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
A plugin for L to fetch the f8d comic from http://www.f8d.org/ |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
See L and L for information on the WWW::Comic |
34
|
|
|
|
|
|
|
interface. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 FUNCTIONS |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=over 4 |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=item new |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Constructor - see L for usage |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=cut |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub new { |
49
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
50
|
0
|
|
|
|
|
|
my $self = { homepage => 'http://www.f8d.org/' }; |
51
|
0
|
|
|
|
|
|
bless $self, $class; |
52
|
0
|
|
|
|
|
|
return $self; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=item strip_url |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Returns the URL to the current strip image (or, if given the 'id' param, |
58
|
|
|
|
|
|
|
the URL to that particular strip) |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub strip_url { |
63
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
64
|
0
|
|
|
|
|
|
my %param = @_; |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
my $url = $self->{homepage}; |
67
|
0
|
0
|
|
|
|
|
$url .= "?c=$param{id}/" if $param{id}; |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
my $response = $self->_new_agent->get($url); |
70
|
0
|
0
|
|
|
|
|
if ($response->is_success) { |
71
|
0
|
|
|
|
|
|
my $html = $response->content; |
72
|
0
|
0
|
|
|
|
|
if ($html =~ m{
|
73
|
0
|
|
|
|
|
|
my $stripurl = $1; |
74
|
0
|
0
|
|
|
|
|
if (!$stripurl !~ /^http/) { |
75
|
0
|
|
|
|
|
|
$stripurl = "http://f8d.org" . $stripurl; |
76
|
0
|
|
|
|
|
|
return $stripurl; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
} else { |
79
|
0
|
|
|
|
|
|
carp "Failed to find f8d comic strip at $url"; |
80
|
0
|
|
|
|
|
|
warn "Content was:\n$html\n"; |
81
|
0
|
|
|
|
|
|
return; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
} else { |
85
|
0
|
|
|
|
|
|
carp "Failed to fetch $url - " . $response->status_line; |
86
|
0
|
|
|
|
|
|
return; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=back |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 AUTHOR |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
David Precious, C<< >> |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 BUGS |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
102
|
|
|
|
|
|
|
C, |
103
|
|
|
|
|
|
|
or through the web interface at |
104
|
|
|
|
|
|
|
L. |
105
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
106
|
|
|
|
|
|
|
your bug as I make changes. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 SUPPORT |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
perldoc WWW::Comic::Plugin::f8d |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
You can also look for information at: |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=over 4 |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
L |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
L |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=item * CPAN Ratings |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
L |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=item * Search CPAN |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
L |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=back |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
To Nicola Worthington (NICOLAW) for writing WWW::Comic |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Copyright 2008-09 David Precious, all rights reserved. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
150
|
|
|
|
|
|
|
under the same terms as Perl itself. |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=cut |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
1; # End of WWW::Comic::Plugin::f8d |