| 1 | package WWW::Scramble::Entry; | ||
| 2 | 0 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 3 | use URI; | ||
| 4 | use WWW::Scramble::Handler; | ||
| 5 | use HTML::Element; | ||
| 6 | |||
| 7 | =head1 NAME | ||
| 8 | |||
| 9 | WWW::Scramble::Entry | ||
| 10 | |||
| 11 | =head1 SYNOPSIS | ||
| 12 | |||
| 13 | Quick summary of what the module does. | ||
| 14 | |||
| 15 | =cut | ||
| 16 | |||
| 17 | has title => (is => 'rw', isa => 'HTML::Element'); | ||
| 18 | has content => (is => 'rw', isa => 'HTML::Element'); | ||
| 19 | has _rawdata => ( is => 'rw', isa => 'Str' ); | ||
| 20 | has _handler => ( | ||
| 21 | is => 'ro', isa => 'WWW::Scramble::Handler', required => 1 | ||
| 22 | ); | ||
| 23 | has URI => ( | ||
| 24 | is => 'rw', isa => 'URI', | ||
| 25 | default => sub { URI->new() } | ||
| 26 | ); | ||
| 27 | |||
| 28 | =head2 BUILD | ||
| 29 | |||
| 30 | =cut | ||
| 31 | |||
| 32 | sub BUILD { | ||
| 33 | my $self = shift; | ||
| 34 | $self->_handler->parse($self->_rawdata); | ||
| 35 | $self->title ($self->_handler->get_title); | ||
| 36 | $self->content ($self->_handler->get_content); | ||
| 37 | } | ||
| 38 | |||
| 39 | sub get_field { | ||
| 40 | my ($self) = shift; | ||
| 41 | return $self->_handler->get_field(@_); | ||
| 42 | } | ||
| 43 | |||
| 44 | no Moose; | ||
| 45 | __PACKAGE__->meta->make_immutable; | ||
| 46 | 1; | ||