|
has 'headers' => (
is => 'ro' ,
isa => 'HTTP::Headers' ,
required => 1,
);
has 'content' => (
is => 'ro' ,
isa => 'Str' ,
required => 1,
);
has 'successful' => (
is => 'ro' ,
isa => 'Bool' ,
required => 1,
);
has 'request_uri' => (
is => 'ro' ,
isa => 'URI' ,
required => 1,
);
has 'content_types' => (
is => 'ro' ,
isa => 'HashRef' ,
required => 1,
default => sub {
{
'text/html' => 'HTML' ,
'text/plain' => 'Plaintext' ,
'text/xml' => 'XML' ,
'application/xml' => 'XML' ,
}
},
);
sub BUILD {
my $self = shift ;
my $content_type = lc ( $self ->headers->content_type);
die ( "Unsupported content type $content_type" )
unless exists $self ->content_types->{ $content_type };
Moose::Util::apply_all_roles( $self , 'WWW::WTF::HTTPResource::' . $self ->content_types->{ $content_type });
}
sub get_links { ... }
sub get_image_uris { ... }
sub get_headings { ... }
__PACKAGE__->meta->make_immutable;
1;
|