| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# Copyrights 2007-2019 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-SOAP. 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::XOP::Include; |
|
10
|
2
|
|
|
2
|
|
15
|
use vars '$VERSION'; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
138
|
|
|
11
|
|
|
|
|
|
|
$VERSION = '3.26'; |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
2
|
|
|
2
|
|
15
|
use warnings; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
53
|
|
|
15
|
2
|
|
|
2
|
|
10
|
use strict; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
40
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
2
|
|
|
2
|
|
8
|
use Log::Report 'xml-compile-soap'; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
10
|
|
|
18
|
2
|
|
|
2
|
|
589
|
use XML::Compile::SOAP::Util qw/:xop10/; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
201
|
|
|
19
|
2
|
|
|
2
|
|
12
|
use HTTP::Message (); |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
95
|
|
|
20
|
2
|
|
|
2
|
|
1187
|
use File::Slurper qw/read_binary write_binary/; |
|
|
2
|
|
|
|
|
6369
|
|
|
|
2
|
|
|
|
|
125
|
|
|
21
|
2
|
|
|
2
|
|
97
|
use Encode qw/decode FB_CROAK/; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
161
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
|
24
|
2
|
|
|
|
|
17
|
use overload '""' => 'content' |
|
25
|
2
|
|
|
2
|
|
13
|
, fallback => 1; |
|
|
2
|
|
|
|
|
5
|
|
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub new(@) |
|
29
|
4
|
|
|
4
|
1
|
782
|
{ my ($class, %args) = @_; |
|
30
|
|
|
|
|
|
|
$args{bytes} = \(delete $args{bytes}) |
|
31
|
4
|
100
|
66
|
|
|
55
|
if defined $args{bytes} && ref $args{bytes} ne 'SCALAR'; |
|
32
|
4
|
|
|
|
|
23
|
bless \%args, $class; |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub fromMime($) |
|
37
|
2
|
|
|
2
|
1
|
7
|
{ my ($class, $http) = @_; |
|
38
|
|
|
|
|
|
|
|
|
39
|
2
|
|
50
|
|
|
7
|
my $cid = $http->header('Content-ID') || ''; |
|
40
|
2
|
50
|
|
|
|
132
|
if($cid !~ s/^\s*\<(.*?)\>\s*$/$1/ ) |
|
41
|
0
|
|
|
|
|
0
|
{ warning __x"part has illegal Content-ID: `{cid}'", cid => $cid; |
|
42
|
0
|
|
|
|
|
0
|
return (); |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
2
|
|
33
|
|
|
8
|
my $content = $http->decoded_content(ref => 1) || $http->content(ref => 1); |
|
46
|
2
|
|
|
|
|
765
|
$class->new |
|
47
|
|
|
|
|
|
|
( bytes => $content |
|
48
|
|
|
|
|
|
|
, cid => $cid |
|
49
|
|
|
|
|
|
|
, type => scalar $http->content_type |
|
50
|
|
|
|
|
|
|
, charset => scalar $http->content_type_charset |
|
51
|
|
|
|
|
|
|
); |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
|
55
|
4
|
|
|
4
|
1
|
1523
|
sub cid { shift->{cid} } |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub content(;$) |
|
59
|
15
|
|
|
15
|
1
|
1717
|
{ my ($self, $byref) = @_; |
|
60
|
15
|
50
|
|
|
|
76
|
unless($self->{bytes}) |
|
61
|
0
|
|
|
|
|
0
|
{ my $f = $self->{file}; |
|
62
|
0
|
|
|
0
|
|
0
|
my $bytes = try { read_binary $f }; |
|
|
0
|
|
|
|
|
0
|
|
|
63
|
0
|
0
|
|
|
|
0
|
fault "failed reading XOP file {fn}", fn => $f if $@; |
|
64
|
0
|
|
|
|
|
0
|
$self->{bytes} = \$bytes; |
|
65
|
|
|
|
|
|
|
} |
|
66
|
15
|
100
|
|
|
|
50
|
$byref ? $self->{bytes} : ${$self->{bytes}}; |
|
|
12
|
|
|
|
|
48
|
|
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub string() { |
|
71
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
72
|
0
|
|
0
|
|
|
0
|
my $cs = $self->contentCharset || 'UTF-8'; |
|
73
|
0
|
|
|
|
|
0
|
decode $cs, $self->content, FB_CROAK; |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
|
77
|
0
|
|
|
0
|
1
|
0
|
sub contentType() { shift->{type} } |
|
78
|
0
|
|
|
0
|
1
|
0
|
sub contentCharset() { shift->{charset} } |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
#--------- |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub xmlNode($$$$) |
|
83
|
1
|
|
|
1
|
1
|
4
|
{ my ($self, $doc, $path, $tag) = @_; |
|
84
|
1
|
|
|
|
|
8
|
my $node = $doc->createElement($tag); |
|
85
|
1
|
|
|
|
|
6
|
$node->setNamespace($self->{xmime}, 'xmime', 0); |
|
86
|
1
|
|
|
|
|
19
|
$node->setAttributeNS($self->{xmime}, contentType => $self->{type}); |
|
87
|
|
|
|
|
|
|
|
|
88
|
1
|
|
|
|
|
33
|
my $include = $node->addChild($doc->createElement('Include')); |
|
89
|
1
|
|
|
|
|
4
|
$include->setNamespace($self->{xop}, 'xop', 1); |
|
90
|
1
|
|
|
|
|
62
|
$include->setAttribute(href => 'cid:'.$self->{cid}); |
|
91
|
1
|
|
|
|
|
12
|
$node; |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub mimePart(;$) |
|
96
|
2
|
|
|
2
|
1
|
2249
|
{ my ($self, $headers) = @_; |
|
97
|
2
|
|
|
|
|
13
|
my $mime = HTTP::Message->new($headers); |
|
98
|
|
|
|
|
|
|
$mime->header |
|
99
|
|
|
|
|
|
|
( Content_Type => $self->{type} |
|
100
|
|
|
|
|
|
|
, Content_Transfer_Encoding => 'binary' |
|
101
|
2
|
|
|
|
|
63
|
, Content_ID => '<'.$self->{cid}.'>' |
|
102
|
|
|
|
|
|
|
); |
|
103
|
|
|
|
|
|
|
|
|
104
|
2
|
|
|
|
|
337
|
$mime->content_ref($self->content(1)); |
|
105
|
2
|
|
|
|
|
43
|
$mime; |
|
106
|
|
|
|
|
|
|
} |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub write($) |
|
110
|
0
|
|
|
0
|
1
|
|
{ my ($self, $file) = @_; |
|
111
|
0
|
|
|
|
|
|
write_binary $file, $self->content(1); |
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
1; |