line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyrights 2009-2020 by [Mark Overmeer ]. |
2
|
|
|
|
|
|
|
# For other contributors see ChangeLog. |
3
|
|
|
|
|
|
|
# See the manual pages for details on the licensing terms. |
4
|
|
|
|
|
|
|
# Pod stripped from pm file by OODoc 2.02. |
5
|
|
|
|
|
|
|
# This code is part of distribution XML-Compile-RPC. Meta-POD processed |
6
|
|
|
|
|
|
|
# with OODoc into POD and HTML manual-pages. See README.md |
7
|
|
|
|
|
|
|
# Copyright Mark Overmeer. Licensed under the same terms as Perl itself. |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
package XML::Compile::RPC; |
10
|
4
|
|
|
4
|
|
240534
|
use vars '$VERSION'; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
190
|
|
11
|
|
|
|
|
|
|
$VERSION = '0.20'; |
12
|
|
|
|
|
|
|
|
13
|
4
|
|
|
4
|
|
22
|
use base 'XML::Compile::Cache'; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
1613
|
|
14
|
|
|
|
|
|
|
|
15
|
4
|
|
|
4
|
|
815854
|
use warnings; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
99
|
|
16
|
4
|
|
|
4
|
|
21
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
106
|
|
17
|
|
|
|
|
|
|
|
18
|
4
|
|
|
4
|
|
20
|
use Log::Report 'xml-compile-rpc', syntax => 'SHORT'; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
25
|
|
19
|
4
|
|
|
4
|
|
987
|
use File::Glob qw/bsd_glob/; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
410
|
|
20
|
4
|
|
|
4
|
|
29
|
use File::Basename qw/dirname/; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
1788
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub init($) |
24
|
3
|
|
|
3
|
0
|
49
|
{ my ($self, $args) = @_; |
25
|
|
|
|
|
|
|
|
26
|
3
|
|
|
|
|
7
|
unshift @{$args->{opts_rw}} |
|
3
|
|
|
|
|
18
|
|
27
|
|
|
|
|
|
|
, sloppy_floats => 1 # no need for Big:: |
28
|
|
|
|
|
|
|
, sloppy_integers => 1 |
29
|
|
|
|
|
|
|
, mixed_elements => 'STRUCTURAL'; |
30
|
|
|
|
|
|
|
|
31
|
3
|
|
|
|
|
7
|
unshift @{$args->{opts_readers}} |
|
3
|
|
|
|
|
26
|
|
32
|
|
|
|
|
|
|
, hooks => |
33
|
|
|
|
|
|
|
[ {type => 'ValueType', replace => \&_rewrite_string} |
34
|
|
|
|
|
|
|
, {type => 'ISO8601', replace => \&_reader_rewrite_date} |
35
|
|
|
|
|
|
|
]; |
36
|
|
|
|
|
|
|
|
37
|
3
|
|
|
|
|
6
|
unshift @{$args->{opts_writers}} |
|
3
|
|
|
|
|
15
|
|
38
|
|
|
|
|
|
|
, hooks => |
39
|
|
|
|
|
|
|
[ {type => 'ISO8601', before => \&_writer_rewrite_date} |
40
|
|
|
|
|
|
|
]; |
41
|
|
|
|
|
|
|
|
42
|
3
|
|
|
|
|
25
|
$self->SUPER::init($args); |
43
|
|
|
|
|
|
|
|
44
|
3
|
|
|
|
|
1209
|
$self->addPrefixes |
45
|
|
|
|
|
|
|
( ex => 'http://ws.apache.org/xmlrpc/namespaces/extensions' |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
|
48
|
3
|
|
|
|
|
236
|
(my $xsddir = __FILE__) =~ s/\.pm$//i; |
49
|
3
|
|
|
|
|
363
|
my @xsds = bsd_glob "$xsddir/*.xsd"; |
50
|
3
|
|
|
|
|
36
|
$self->importDefinitions(\@xsds); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# only declared methods are accepted by the Cache |
53
|
3
|
|
|
|
|
9481
|
$self->declare(WRITER => 'methodCall'); |
54
|
3
|
|
|
|
|
239
|
$self->declare(READER => 'methodResponse'); |
55
|
3
|
|
|
|
|
158
|
$self; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub _rewrite_string($$$$$) |
59
|
6
|
|
|
6
|
|
127792
|
{ my ($element, $reader, $path, $type, $replaced) = @_; |
60
|
|
|
|
|
|
|
|
61
|
6
|
100
|
|
|
|
21
|
(grep $_->isa('XML::LibXML::Element'), $element->childNodes) |
62
|
|
|
|
|
|
|
? $replaced->($element) |
63
|
|
|
|
|
|
|
: (value => {string => $element->textContent}); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
# xsd:dateTime requires - and : between the components |
67
|
|
|
|
|
|
|
sub _iso8601_to_dateTime($) |
68
|
3
|
|
|
3
|
|
7
|
{ my $s = shift; |
69
|
3
|
|
|
|
|
44
|
$s =~ s/^([12][0-9][0-9][0-9])-?([01][0-9])-?([0-3][0-9])T/$1-$2-$3T/; |
70
|
3
|
|
|
|
|
27
|
$s =~ s/T([012][0-9]):?([0-5][0-9]):?([0-6][0-9])/T$1:$2:$3/; |
71
|
3
|
|
|
|
|
13
|
$s; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub _writer_rewrite_date |
75
|
2
|
|
|
2
|
|
42305
|
{ my ($doc, $string, $path) = @_; |
76
|
2
|
|
|
|
|
9
|
_iso8601_to_dateTime $string; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub _reader_rewrite_date |
80
|
1
|
|
|
1
|
|
160
|
{ my ($element, $reader, $path, $type, $replaced) = @_; |
81
|
1
|
|
|
|
|
16
|
my $schema_time = _iso8601_to_dateTime $element->textContent; |
82
|
|
|
|
|
|
|
# $schema_time should get validated... |
83
|
1
|
|
|
|
|
6
|
('dateTime.iso8601' => $schema_time); |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
1; |