| 1 | package Web::Atom::Plugin; | ||||||||||
| 2 | 2 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 2 | $Web::Atom::Plugin::VERSION = '0.1.0'; | |||||||||
| 4 | } | ||||||||||
| 5 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | =head1 NAME | ||||||||||
| 9 | |||||||||||
| 10 | Web::Atom::Plugin - Base class of plugins | ||||||||||
| 11 | |||||||||||
| 12 | =head1 VERSION | ||||||||||
| 13 | |||||||||||
| 14 | version 0.1.0 | ||||||||||
| 15 | |||||||||||
| 16 | =cut | ||||||||||
| 17 | |||||||||||
| 18 | 2 | ▶ | use Any::Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 2 | has 'author_email' => (is => 'rw', isa => 'Str', default => 'example@example.com'); | |||||||||
| 20 | 2 | has 'author_name' => (is => 'rw', isa => 'Str', default => 'John Doe'); | |||||||||
| 21 | 2 | has 'body' => (is => 'rw', isa => 'Str', lazy_build => 1); | |||||||||
| 22 | 2 | has 'id' => (is => 'rw', isa => 'Str'); | |||||||||
| 23 | 2 | has 'title' => (is => 'rw', isa => 'Str', default => 'Default title'); | |||||||||
| 24 | 2 | has 'url' => (is => 'rw', isa => 'Str'); | |||||||||
| 25 | 2 | has 'url_encoding' => (is => 'rw', isa => 'Str', default => ''); | |||||||||
| 26 | |||||||||||
| 27 | 2 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 28 | 2 | ▶ | use Encode; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 29 | 2 | ▶ | use LWP::UserAgent; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 30 | 2 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 31 | |||||||||||
| 32 | 0 | ▶ | sub _build_body { | ||||||||
|
Subroutine
_build_body: not called CC=2 SCAR=17.9
| |||||||||||
| 33 | 0 | my $self = shift; | |||||||||
| 34 | |||||||||||
| 35 | 0 | my $ua = LWP::UserAgent->new; | |||||||||
| 36 | 0 | $ua->ssl_opts(verify_hostname => 0); | |||||||||
| 37 | |||||||||||
| 38 | 0 | my $res = $ua->get($self->url); | |||||||||
| 39 | 0 | ▶ | if ('' eq $self->url_encoding) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 40 | 0 | return encode('utf8', $res->decoded_content); | |||||||||
| 41 | } else { | ||||||||||
| 42 | 0 | return encode('utf8', decode($self->url_encoding, $res->content)); | |||||||||
| 43 | } | ||||||||||
| 44 | } | ||||||||||
| 45 | |||||||||||
| 46 | =head2 entries | ||||||||||
| 47 | |||||||||||
| 48 | =cut | ||||||||||
| 49 | |||||||||||
| 50 | 0 | ▶ | sub entries { | ||||||||
|
Subroutine
entries: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 51 | 0 | croak 'Not implemented'; | |||||||||
| 52 | } | ||||||||||
| 53 | |||||||||||
| 54 | 2 | __PACKAGE__->meta->make_immutable; | |||||||||
| 55 | |||||||||||
| 56 | =head1 AUTHOR | ||||||||||
| 57 | |||||||||||
| 58 | Gea-Suan Lin, C<< <gslin at gslin.org> >> | ||||||||||
| 59 | |||||||||||
| 60 | =head1 LICENSE AND COPYRIGHT | ||||||||||
| 61 | |||||||||||
| 62 | Copyright 2011 Gea-Suan Lin. | ||||||||||
| 63 | |||||||||||
| 64 | This software is released under 3-clause BSD license. See | ||||||||||
| 65 | L<http://www.opensource.org/licenses/bsd-license.php> for more | ||||||||||
| 66 | information. | ||||||||||
| 67 | |||||||||||
| 68 | =cut | ||||||||||
| 69 | |||||||||||
| 70 | 2 | 1; | |||||||||