line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package W3C::SOAP::XSD::Document::SimpleType; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Created on: 2012-05-26 19:04:19 |
4
|
|
|
|
|
|
|
# Create by: Ivan Wills |
5
|
|
|
|
|
|
|
# $Id$ |
6
|
|
|
|
|
|
|
# $Revision$, $HeadURL$, $Date$ |
7
|
|
|
|
|
|
|
# $Revision$, $Source$, $Date$ |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
1314
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
10
|
1
|
|
|
1
|
|
5098
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
37
|
|
11
|
1
|
|
|
1
|
|
5
|
use version; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
12
|
1
|
|
|
1
|
|
57
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
61
|
|
13
|
1
|
|
|
1
|
|
6
|
use Scalar::Util; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
33
|
|
14
|
1
|
|
|
1
|
|
4
|
use List::Util; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
53
|
|
15
|
|
|
|
|
|
|
#use List::MoreUtils; |
16
|
1
|
|
|
1
|
|
4
|
use Data::Dumper qw/Dumper/; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
37
|
|
17
|
1
|
|
|
1
|
|
5
|
use English qw/ -no_match_vars /; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
12
|
|
18
|
1
|
|
|
1
|
|
374
|
use W3C::SOAP::Utils qw/split_ns/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
extends 'W3C::SOAP::XSD::Document::Type'; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
our $VERSION = version->new('0.11'); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has type => ( |
25
|
|
|
|
|
|
|
is => 'rw', |
26
|
|
|
|
|
|
|
isa => 'Str', |
27
|
|
|
|
|
|
|
builder => '_type', |
28
|
|
|
|
|
|
|
lazy => 1, |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
has list => ( |
31
|
|
|
|
|
|
|
is => 'rw', |
32
|
|
|
|
|
|
|
isa => 'Bool', |
33
|
|
|
|
|
|
|
builder => '_list', |
34
|
|
|
|
|
|
|
lazy => 1, |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
has enumeration => ( |
37
|
|
|
|
|
|
|
is => 'rw', |
38
|
|
|
|
|
|
|
isa => 'ArrayRef[Str]', |
39
|
|
|
|
|
|
|
builder => '_enumeration', |
40
|
|
|
|
|
|
|
lazy => 1, |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
has pattern => ( |
43
|
|
|
|
|
|
|
is => 'rw', |
44
|
|
|
|
|
|
|
isa => 'Maybe[Str]', |
45
|
|
|
|
|
|
|
builder => '_pattern', |
46
|
|
|
|
|
|
|
predicate => 'has_pattern', |
47
|
|
|
|
|
|
|
lazy => 1, |
48
|
|
|
|
|
|
|
); |
49
|
|
|
|
|
|
|
has maxLength => ( |
50
|
|
|
|
|
|
|
is => 'rw', |
51
|
|
|
|
|
|
|
isa => 'Maybe[Int]', |
52
|
|
|
|
|
|
|
builder => '_maxLength', |
53
|
|
|
|
|
|
|
predicate => 'has_minLength', |
54
|
|
|
|
|
|
|
lazy => 1, |
55
|
|
|
|
|
|
|
); |
56
|
|
|
|
|
|
|
has minLength => ( |
57
|
|
|
|
|
|
|
is => 'rw', |
58
|
|
|
|
|
|
|
isa => 'Maybe[Int]', |
59
|
|
|
|
|
|
|
builder => '_minLength', |
60
|
|
|
|
|
|
|
predicate => 'has_maxLength', |
61
|
|
|
|
|
|
|
lazy => 1, |
62
|
|
|
|
|
|
|
); |
63
|
|
|
|
|
|
|
has length => ( |
64
|
|
|
|
|
|
|
is => 'rw', |
65
|
|
|
|
|
|
|
isa => 'Maybe[Int]', |
66
|
|
|
|
|
|
|
builder => '_length', |
67
|
|
|
|
|
|
|
predicate => 'has_length', |
68
|
|
|
|
|
|
|
lazy => 1, |
69
|
|
|
|
|
|
|
); |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub _type { |
72
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
73
|
0
|
|
|
|
|
|
my ($restriction) = $self->document->xpc->findnodes('xsd:restriction', $self->node); |
74
|
|
|
|
|
|
|
|
75
|
0
|
0
|
|
|
|
|
return $restriction->getAttribute('base') if $restriction; |
76
|
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
($restriction) = $self->document->xpc->findnodes('xsd:list/xsd:simpleType/xsd:restriction', $self->node); |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
return $restriction->getAttribute('base'); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub _list { |
83
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
84
|
0
|
|
|
|
|
|
my ($restriction) = $self->document->xpc->findnodes('xsd:list', $self->node); |
85
|
|
|
|
|
|
|
|
86
|
0
|
0
|
|
|
|
|
return $restriction ? 1 : undef; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub _enumeration { |
90
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
91
|
0
|
|
|
|
|
|
my @nodes = $self->document->xpc->findnodes('xsd:restriction/xsd:enumeration', $self->node); |
92
|
0
|
|
|
|
|
|
my @enumeration; |
93
|
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
for my $node (@nodes) { |
95
|
0
|
|
|
|
|
|
push @enumeration, $node->getAttribute('value'); |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
0
|
|
|
|
|
|
return \@enumeration; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
0
|
|
|
0
|
|
|
sub _pattern { return shift->_build_restriction('pattern') } |
102
|
0
|
|
|
0
|
|
|
sub _maxLength { return shift->_build_restriction('maxLength') } |
103
|
0
|
|
|
0
|
|
|
sub _minLength { return shift->_build_restriction('minLength') } |
104
|
0
|
|
|
0
|
|
|
sub _length { return shift->_build_restriction('length') } |
105
|
|
|
|
|
|
|
sub _build_restriction { |
106
|
0
|
|
|
0
|
|
|
my ($self, $type) = @_; |
107
|
0
|
|
|
|
|
|
my ($node) = $self->document->xpc->findnodes("xsd:restriction/xsd:$type", $self->node); |
108
|
0
|
|
|
|
|
|
return $node->getAttribute('value'); |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub moose_type { |
112
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
113
|
|
|
|
|
|
|
|
114
|
0
|
0
|
|
|
|
|
warn "No name for ".$self->node->toString if !$self->name; |
115
|
0
|
|
|
|
|
|
my $type = $self->document->module . ':' . $self->name; |
116
|
|
|
|
|
|
|
|
117
|
0
|
|
|
|
|
|
return $type; |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub moose_base_type { |
121
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
122
|
0
|
|
|
|
|
|
my ($ns, $type) = split_ns($self->type); |
123
|
0
|
|
0
|
|
|
|
$ns ||= $self->document->target_namespace; |
124
|
0
|
0
|
0
|
|
|
|
return "xs:$type" if $self->document->ns_map->{$ns} && $self->document->ns_map->{$ns} eq 'http://www.w3.org/2001/XMLSchema'; |
125
|
|
|
|
|
|
|
|
126
|
0
|
|
|
|
|
|
my $ns_uri = $self->document->get_ns_uri($ns, $self->node); |
127
|
|
|
|
|
|
|
|
128
|
0
|
0
|
|
|
|
|
return "xs:$type" if $ns_uri eq 'http://www.w3.org/2001/XMLSchema'; |
129
|
|
|
|
|
|
|
|
130
|
0
|
|
|
|
|
|
return $type; |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub moosex_type { |
134
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
135
|
|
|
|
|
|
|
|
136
|
0
|
0
|
|
|
|
|
warn "No name for ".$self->node->toString if !$self->name; |
137
|
0
|
|
|
|
|
|
return $self->name; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
1; |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
__END__ |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head1 NAME |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
W3C::SOAP::XSD::Document::SimpleType - Represents simpleType elements of XSD documents |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head1 VERSION |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
This documentation refers to W3C::SOAP::XSD::Document::SimpleType version 0.11. |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head1 SYNOPSIS |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
use W3C::SOAP::XSD::Document::SimpleType; |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
# Brief but working code example(s) here showing the most common usage(s) |
158
|
|
|
|
|
|
|
# This section will be as far as many users bother reading, so make it as |
159
|
|
|
|
|
|
|
# educational and exemplary as possible. |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head1 DESCRIPTION |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=over 4 |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=item C<moose_type ()> |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=item C<moose_base_type ()> |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=item C<moosex_type ()> |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=back |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=head1 DIAGNOSTICS |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head1 CONFIGURATION AND ENVIRONMENT |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=head1 INCOMPATIBILITIES |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
There are no known bugs in this module. |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
Please report problems to Ivan Wills (ivan.wills@gmail.com). |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
Patches are welcome. |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head1 AUTHOR |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
Ivan Wills - (ivan.wills@gmail.com) |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
Copyright (c) 2012 Ivan Wills (14 Mullion Close, Hornsby Heights, NSW Australia 2077). |
200
|
|
|
|
|
|
|
All rights reserved. |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or modify it under |
203
|
|
|
|
|
|
|
the same terms as Perl itself. See L<perlartistic>. This program is |
204
|
|
|
|
|
|
|
distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
205
|
|
|
|
|
|
|
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
206
|
|
|
|
|
|
|
PARTICULAR PURPOSE. |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=cut |