Dezi-App

 view release on metacpan or  search on metacpan

lib/Dezi/Aggregator/Mail.pm  view on Meta::CPAN

147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
}
 
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

992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
    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

1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
    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

103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
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.318 second using v1.01-cache-2.11-cpan-454fe037f31 )