line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Apache::AxKit::Provider::DOM; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
844
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use vars qw( $VERSION @ISA ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
64
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
1662
|
use Apache::AxKit::Exception; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use Apache::AxKit::Provider; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
$VERSION = 0.01; |
11
|
|
|
|
|
|
|
@ISA = ('Apache::AxKit::Provider'); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
#------------------------------------------------------------------------# |
14
|
|
|
|
|
|
|
# process # |
15
|
|
|
|
|
|
|
#------------------------------------------------------------------------# |
16
|
|
|
|
|
|
|
# AxKit should only process the ressource if the provider has a dom_tree |
17
|
|
|
|
|
|
|
# |
18
|
|
|
|
|
|
|
sub process { |
19
|
|
|
|
|
|
|
my $self = shift; |
20
|
|
|
|
|
|
|
return defined $self->{dom_tree} ? 1 : 0 ; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub exists { |
24
|
|
|
|
|
|
|
my $self = shift; |
25
|
|
|
|
|
|
|
return $self->process; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
#------------------------------------------------------------------------# |
29
|
|
|
|
|
|
|
# pseudo noops # |
30
|
|
|
|
|
|
|
#------------------------------------------------------------------------# |
31
|
|
|
|
|
|
|
sub mtime { return time; } |
32
|
|
|
|
|
|
|
sub has_changed { return 1; } |
33
|
|
|
|
|
|
|
sub key { return 'dom_provider'; } |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub get_fh { |
36
|
|
|
|
|
|
|
throw Apache::AxKit::Exception::IO( -text => "Can't get fh for Scalar" ); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
#------------------------------------------------------------------------# |
40
|
|
|
|
|
|
|
# get_strref # |
41
|
|
|
|
|
|
|
#------------------------------------------------------------------------# |
42
|
|
|
|
|
|
|
# The DOM provider returns the string value of the document tree if a |
43
|
|
|
|
|
|
|
# document is present, otherwise it throws an error |
44
|
|
|
|
|
|
|
# |
45
|
|
|
|
|
|
|
sub get_strref { |
46
|
|
|
|
|
|
|
my $self = shift; |
47
|
|
|
|
|
|
|
if ( defined $self->{dom_tree} ) { |
48
|
|
|
|
|
|
|
my $str = $self->{dom_tree}->toString; |
49
|
|
|
|
|
|
|
$self->{apache}->pnotes('dom_tree' => $self->{dom_tree} ); |
50
|
|
|
|
|
|
|
return \$str; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
else { |
53
|
|
|
|
|
|
|
throw Apache::AxKit::Exception::IO( -text => "Can't get the XML DOM" ); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
__END__ |