line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# -*- perl -*-
|
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
644
|
use strict;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
381
|
use XML::DOM ();
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package XML::EP::Producer::File;
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
$XML::EP::Producer::File::VERSION = '0.01';
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new {
|
13
|
|
|
|
|
|
|
my $proto = shift;
|
14
|
|
|
|
|
|
|
my $self = (@_ == 1) ? \%{ shift() } : { @_ };
|
15
|
|
|
|
|
|
|
bless($self, (ref($proto) || $proto));
|
16
|
|
|
|
|
|
|
}
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub Produce {
|
19
|
|
|
|
|
|
|
my $self = shift; my $ep = shift;
|
20
|
|
|
|
|
|
|
my $request = $ep->Request();
|
21
|
|
|
|
|
|
|
my $path = $request->PathTranslated() || $request->PathInfo() ||
|
22
|
|
|
|
|
|
|
die XML::EP::Error->new("Missing path specification", 500);
|
23
|
|
|
|
|
|
|
die XML::EP::Error->new("No such file or directory", 404)
|
24
|
|
|
|
|
|
|
unless -f $path;
|
25
|
|
|
|
|
|
|
$ep->{'path'} = $path;
|
26
|
|
|
|
|
|
|
$ep->{'path_mtime'} = (stat _)[9];
|
27
|
|
|
|
|
|
|
my $parser = XML::DOM::Parser->new();
|
28
|
|
|
|
|
|
|
my $xml = $parser->parsefile($path) ||
|
29
|
|
|
|
|
|
|
die XML::EP::Error->new("Failed to parse $path", 500);
|
30
|
|
|
|
|
|
|
$xml;
|
31
|
|
|
|
|
|
|
}
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1;
|