| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Apache::AxKit::Provider::PodSAX; |
|
2
|
1
|
|
|
1
|
|
15923
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
40
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use vars qw/@ISA $VERSION/; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
78
|
|
|
4
|
|
|
|
|
|
|
@ISA = ('Apache::AxKit::Provider::File'); |
|
5
|
|
|
|
|
|
|
$VERSION = '1.00'; |
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
1542
|
use Apache::AxKit::Provider::File; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use XML::SAX::Writer; |
|
9
|
|
|
|
|
|
|
use Pod::SAX; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub get_strref { |
|
12
|
|
|
|
|
|
|
my $self = shift; |
|
13
|
|
|
|
|
|
|
if ($self->_is_dir()) { |
|
14
|
|
|
|
|
|
|
throw Apache::AxKit::Exception::IO( |
|
15
|
|
|
|
|
|
|
-text => "$self->{file} is a directory - please overload File provider and use AxContentProvider option"); |
|
16
|
|
|
|
|
|
|
} |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my $outie; |
|
19
|
|
|
|
|
|
|
my $w = XML::SAX::Writer->new( Output => \$outie ); |
|
20
|
|
|
|
|
|
|
my $generator = Pod::SAX->new( Handler => $w) ; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
eval { |
|
23
|
|
|
|
|
|
|
$generator->parse_uri( $self->{file} ); |
|
24
|
|
|
|
|
|
|
}; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
if (my $error = $@) { |
|
27
|
|
|
|
|
|
|
throw Apache::AxKit::Exception::IO( |
|
28
|
|
|
|
|
|
|
-text => "PodSAX Generator Error: $error"); |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
#warn "OUTIE $outie \n"; |
|
31
|
|
|
|
|
|
|
return \$outie |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub process { |
|
35
|
|
|
|
|
|
|
my $self = shift; |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
my $file = $self->{file}; |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
unless ($self->exists()) { |
|
40
|
|
|
|
|
|
|
AxKit::Debug(5, "file '$file' does not exist or is not readable"); |
|
41
|
|
|
|
|
|
|
return 0; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
if ( $self->_is_dir ) { |
|
45
|
|
|
|
|
|
|
if ($AxKit::Cfg->HandleDirs()) { |
|
46
|
|
|
|
|
|
|
return 1; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
# else |
|
49
|
|
|
|
|
|
|
AxKit::Debug(5, "'$file' is a directory"); |
|
50
|
|
|
|
|
|
|
return 0; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
local $^W; |
|
54
|
|
|
|
|
|
|
if (($file =~ /\.pod$/i) || |
|
55
|
|
|
|
|
|
|
($self->{apache}->content_type() =~ /^text\/pod/) |
|
56
|
|
|
|
|
|
|
) { |
|
57
|
|
|
|
|
|
|
return 1; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
AxKit::Debug(5, "'$file' not recognised as POD"); |
|
61
|
|
|
|
|
|
|
return 0; |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub get_fh { |
|
65
|
|
|
|
|
|
|
throw Apache::AxKit::Exception::IO( |
|
66
|
|
|
|
|
|
|
-text => "Can't get filehandles from POD" |
|
67
|
|
|
|
|
|
|
); |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |
|
71
|
|
|
|
|
|
|
__END__ |