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