Dezi-App
view release on metacpan or search on metacpan
lib/Dezi/Aggregator/Mail.pm view on Meta::CPAN
147148149150151152153154155156157158159160161162163164165166167}
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
9929939949959969979989991000100110021003100410051006100710081009101010111012
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
101810191020102110221023102410251026102710281029103010311032103310341035103610371038
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
103104105106107108109110111112113114115116117118119120121122123124125126127128sub
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.318 second using v1.01-cache-2.11-cpan-454fe037f31 )