Dezi-App
view release on metacpan or search on metacpan
lib/Dezi/Aggregator/Mail.pm view on Meta::CPAN
}
sub _filter_attachment {
my $self = shift;
my $msg_url = shift or croak "message url required";
my $attm = shift or croak "attachment object required";
my $type = $attm->body->mimeType->type;
my $filename = $attm->body->dispositionFilename;
my $content = $attm->decoded . ''; # force stringify
if ( $self->swish_filter_obj->can_filter($type) ) {
my $f = $self->swish_filter_obj->convert(
document => \$content,
content_type => $type,
name => $filename,
);
if ( !$f
lib/Dezi/Aggregator/Spider.pm view on Meta::CPAN
my $headers = $response->headers;
my $ct = $headers->content_type;
if ( $ct eq 'text/html' or $ct eq 'application/xhtml+xml' ) {
return 0;
}
if ( $ct eq 'text/xml'
or $ct eq 'application/rss+xml'
or $ct eq 'application/rdf+xml'
or $ct eq 'application/atom+xml' )
{
my $xml = $response->decoded_content; # TODO or content()
return XML::Feed->parse( \$xml );
}
return 0;
}
=head2 looks_like_sitemap( I<http_response> )
Called internally to perform naive heuristics on I<http_response>
to determine whether it looks like a XML sitemap feed,
lib/Dezi/Aggregator/Spider.pm view on Meta::CPAN
my $self = shift;
my $response = shift or croak "response required";
my $headers = $response->headers;
my $ct = $headers->content_type;
if ( $ct eq 'text/html' or $ct eq 'application/xhtml+xml' ) {
return 0;
}
if ( $ct eq 'text/xml'
or $ct eq 'application/xml' )
{
my $xml = $response->decoded_content; # TODO or content()
my $sitemap = WWW::Sitemap::XML->new();
eval { $sitemap->load( string => $xml ); };
if ($@) {
return 0;
}
return $sitemap;
}
return 0;
}
lib/Dezi/Aggregator/Spider/Response.pm view on Meta::CPAN
sub is_html {
my $self = shift;
my $ct = $self->ct;
return defined $ct
&& ( $ct eq 'text/html' || $ct eq 'application/xhtml+xml' );
}
=head2 content
Shortcut for $response->http_response->decoded_content.
=cut
sub content {
return shift->http_response->decoded_content;
}
=head2 links
Returns array of href targets in content(). Parsed
using HTML::LinkExtor.
=cut
sub links {
( run in 0.389 second using v1.01-cache-2.11-cpan-26ccb49234f )