line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perlanet::Simple; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
104686
|
use strict; |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
144
|
|
4
|
6
|
|
|
6
|
|
20
|
use warnings; |
|
6
|
|
|
|
|
5
|
|
|
6
|
|
|
|
|
122
|
|
5
|
|
|
|
|
|
|
|
6
|
6
|
|
|
6
|
|
50
|
use 5.6.0; |
|
6
|
|
|
|
|
20
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.58'; |
8
|
|
|
|
|
|
|
|
9
|
6
|
|
|
6
|
|
2066
|
use Moose; |
|
6
|
|
|
|
|
1465797
|
|
|
6
|
|
|
|
|
41
|
|
10
|
6
|
|
|
6
|
|
30456
|
use namespace::autoclean; |
|
6
|
|
|
|
|
29849
|
|
|
6
|
|
|
|
|
25
|
|
11
|
|
|
|
|
|
|
|
12
|
6
|
|
|
6
|
|
288
|
use Carp; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
308
|
|
13
|
6
|
|
|
6
|
|
2242
|
use YAML 'LoadFile'; |
|
6
|
|
|
|
|
29472
|
|
|
6
|
|
|
|
|
1124
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
extends 'Perlanet'; |
16
|
|
|
|
|
|
|
with qw( |
17
|
|
|
|
|
|
|
Perlanet::Trait::Cache |
18
|
|
|
|
|
|
|
Perlanet::Trait::OPML |
19
|
|
|
|
|
|
|
Perlanet::Trait::Scrubber |
20
|
|
|
|
|
|
|
Perlanet::Trait::Tidy |
21
|
|
|
|
|
|
|
Perlanet::Trait::YAMLConfig |
22
|
|
|
|
|
|
|
Perlanet::Trait::TemplateToolkit |
23
|
|
|
|
|
|
|
Perlanet::Trait::FeedFile |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 NAME |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Perlanet::Simple - a DWIM Perlanet |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 SYNOPSIS |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
use Perlanet::Simple; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my $perlanet = Perlanet::Simple->new_with_config( |
35
|
|
|
|
|
|
|
configfile => 'perlanet.yaml' |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
$perlanet->run; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 DESCRIPTION |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
L<Perlanet> provides the driving force behind all Perlanet applications, |
42
|
|
|
|
|
|
|
but it doesn't do a whole lot, which means you would normally have to write |
43
|
|
|
|
|
|
|
the functionality you require. However, in the motive of simplicity, |
44
|
|
|
|
|
|
|
Perlanet::Simple glues enough stuff together to allow you to get a very quick |
45
|
|
|
|
|
|
|
planet working out of the box. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Perlanet::Simple takes the standard Perlanet module, and adds support for |
48
|
|
|
|
|
|
|
caching, OPML feed generation, and L<Template> rendering support. It will |
49
|
|
|
|
|
|
|
also attempt to clean each post using both L<HTML::Scrubber> and L<HTML::Tidy>. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 Configuration |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Perlanet::Simple uses L<Perlanet::Trait::YAMLConfig> to allow you to specify |
54
|
|
|
|
|
|
|
configuration through a file. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
around '_build_ua' => sub { |
59
|
|
|
|
|
|
|
my $orig = shift; |
60
|
|
|
|
|
|
|
my $self = shift; |
61
|
|
|
|
|
|
|
my $ua = $self->$orig; |
62
|
|
|
|
|
|
|
$ua->agent($self->agent) if $self->agent; |
63
|
|
|
|
|
|
|
return $ua; |
64
|
|
|
|
|
|
|
}; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 clean_html |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Some custom cleaning code to remove a nasty piece of BlogSpot HTML |
69
|
|
|
|
|
|
|
(and still running all other cleaning traits) |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
around clean_html => sub { |
74
|
|
|
|
|
|
|
my $orig = shift; |
75
|
|
|
|
|
|
|
my ($self, $html) = @_; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# hack to remove a particularly nasty piece of blogspot HTML |
78
|
|
|
|
|
|
|
$html = $self->$orig($html); |
79
|
|
|
|
|
|
|
$html =~ s|<div align="justify"></div>||g; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
return $html; |
82
|
|
|
|
|
|
|
}; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |