line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
######### |
2
|
|
|
|
|
|
|
# Author: rmp@psyphi.net |
3
|
|
|
|
|
|
|
# Maintainer: rmp@psyphi.net |
4
|
|
|
|
|
|
|
# Created: 2006-06-08 |
5
|
|
|
|
|
|
|
# Last Modified: $Date: 2009/01/09 14:38:54 $ |
6
|
|
|
|
|
|
|
# Id: $Id: File.pm,v 1.3 2009/01/09 14:38:54 zerojinx Exp $ |
7
|
|
|
|
|
|
|
# Source: $Source: /cvsroot/xml-feedlite/xml-feedlite/lib/XML/FeedLite/File.pm,v $ |
8
|
|
|
|
|
|
|
# $HeadURL$ |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
package XML::FeedLite::File; |
11
|
6
|
|
|
6
|
|
96492
|
use strict; |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
201
|
|
12
|
6
|
|
|
6
|
|
32
|
use warnings; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
162
|
|
13
|
6
|
|
|
6
|
|
32
|
use base qw(XML::FeedLite); |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
2815
|
|
14
|
|
|
|
|
|
|
use English qw(-no_match_vars); |
15
|
|
|
|
|
|
|
use Carp; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = do { my @r = (q$Revision: 1.3 $ =~ /\d+/smxg); sprintf '%d.'.'%03d' x $#r, @r }; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub fetch { |
20
|
|
|
|
|
|
|
my ($self, $url_ref) = @_; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
for my $fn (keys %{$url_ref}) { |
23
|
|
|
|
|
|
|
if(!ref $url_ref->{$fn} eq 'CODE') { |
24
|
|
|
|
|
|
|
next; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
open my $fh, q(<), $fn or croak $ERRNO; |
28
|
|
|
|
|
|
|
local $RS = undef; |
29
|
|
|
|
|
|
|
my $xml = <$fh>; |
30
|
|
|
|
|
|
|
close $fh or carp $ERRNO; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
my $cb = $url_ref->{$fn}; |
33
|
|
|
|
|
|
|
&{$cb}(\$xml); ## no critic |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
return; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__END__ |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 NAME |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
XML::FeedLite::File |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 VERSION |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
$Revision: 1.3 $ |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 SYNOPSIS |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 DESCRIPTION |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 fetch - Fetch feed data from file |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
$xflf->fetch({ |
59
|
|
|
|
|
|
|
'/path/to/file1' => sub { ... }, |
60
|
|
|
|
|
|
|
'/path/to/file2# => sub { ... }, |
61
|
|
|
|
|
|
|
}); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 DIAGNOSTICS |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 CONFIGURATION AND ENVIRONMENT |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 INCOMPATIBILITIES |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 AUTHOR |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Roger Pettett, E<lt>rmp@psyphi.netE<gt> |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Copyright (C) 2005 by Roger Pettett |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
82
|
|
|
|
|
|
|
it under the same terms as Perl itself, either Perl version 5.8.4 or, |
83
|
|
|
|
|
|
|
at your option, any later version of Perl 5 you may have available. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=cut |