line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package W3C::SOAP::XSD::Traits; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Created on: 2012-05-26 23:08:42 |
4
|
|
|
|
|
|
|
# Create by: Ivan Wills |
5
|
|
|
|
|
|
|
# $Id$ |
6
|
|
|
|
|
|
|
# $Revision$, $HeadURL$, $Date$ |
7
|
|
|
|
|
|
|
# $Revision$, $Source$, $Date$ |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
38
|
|
10
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
24
|
|
11
|
1
|
|
|
1
|
|
5
|
use version; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
12
|
1
|
|
|
1
|
|
53
|
use Moose::Role; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
13
|
1
|
|
|
1
|
|
4065
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
61
|
|
14
|
1
|
|
|
1
|
|
6
|
use Data::Dumper qw/Dumper/; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
42
|
|
15
|
1
|
|
|
1
|
|
5
|
use English qw/ -no_match_vars /; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
8
|
|
16
|
1
|
|
|
1
|
|
342
|
use Moose::Util::TypeConstraints; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
9
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = version->new('0.11'); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
Moose::Util::meta_attribute_alias('W3C::SOAP::XSD'); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
subtype 'xml_node' => as 'XML::LibXML::Node'; |
23
|
|
|
|
|
|
|
subtype 'PositiveInt', |
24
|
|
|
|
|
|
|
as 'Int', |
25
|
|
|
|
|
|
|
where { $_ >= 0 }, |
26
|
|
|
|
|
|
|
message { "The number you provided, $_, was not a positive number" }; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
has xs_perl_module => ( |
29
|
|
|
|
|
|
|
is => 'rw', |
30
|
|
|
|
|
|
|
isa => 'Str', |
31
|
|
|
|
|
|
|
predicate => 'has_xs_perl_module', |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
has xs_min_occurs => ( |
34
|
|
|
|
|
|
|
is => 'rw', |
35
|
|
|
|
|
|
|
isa => 'PositiveInt', |
36
|
|
|
|
|
|
|
default => 0, |
37
|
|
|
|
|
|
|
predicate => 'has_xs_min_occurs', |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
has xs_max_occurs => ( |
40
|
|
|
|
|
|
|
is => 'rw', |
41
|
|
|
|
|
|
|
isa => 'PositiveInt', |
42
|
|
|
|
|
|
|
default => 1, |
43
|
|
|
|
|
|
|
predicate => 'has_xs_max_occurs', |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
has xs_name => ( |
46
|
|
|
|
|
|
|
is => 'rw', |
47
|
|
|
|
|
|
|
isa => 'Str', |
48
|
|
|
|
|
|
|
predicate => 'has_xs_name', |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
has xs_ns => ( |
51
|
|
|
|
|
|
|
is => 'rw', |
52
|
|
|
|
|
|
|
isa => 'Str', |
53
|
|
|
|
|
|
|
predicate => 'has_xs_ns', |
54
|
|
|
|
|
|
|
); |
55
|
|
|
|
|
|
|
has xs_type => ( |
56
|
|
|
|
|
|
|
is => 'rw', |
57
|
|
|
|
|
|
|
isa => 'Str', |
58
|
|
|
|
|
|
|
predicate => 'has_xs_type', |
59
|
|
|
|
|
|
|
); |
60
|
|
|
|
|
|
|
has xs_choice_group => ( |
61
|
|
|
|
|
|
|
is => 'rw', |
62
|
|
|
|
|
|
|
isa => 'PositiveInt', |
63
|
|
|
|
|
|
|
predicate => 'has_xs_choice_group', |
64
|
|
|
|
|
|
|
); |
65
|
|
|
|
|
|
|
has xs_serialize => ( |
66
|
|
|
|
|
|
|
is => 'rw', |
67
|
|
|
|
|
|
|
isa => 'CodeRef', |
68
|
|
|
|
|
|
|
predicate => 'has_xs_serialize', |
69
|
|
|
|
|
|
|
); |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
__END__ |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 NAME |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
W3C::SOAP::XSD::Traits - Specifies the traits of an XSD Moose attribute |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 VERSION |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
This documentation refers to W3C::SOAP::XSD::Traits version 0.11. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 SYNOPSIS |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
use W3C::SOAP::XSD::Traits; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
# Brief but working code example(s) here showing the most common usage(s) |
89
|
|
|
|
|
|
|
# This section will be as far as many users bother reading, so make it as |
90
|
|
|
|
|
|
|
# educational and exemplary as possible. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 DESCRIPTION |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Defines the Moose attribute trait C<W3C::SOAP::XSD>. This specifies a number |
96
|
|
|
|
|
|
|
of properties that an attribute can have which helps the processing of |
97
|
|
|
|
|
|
|
objects representing XSDs. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=over 4 |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=item C<xs_perl_module> |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
If the attribute has a type that is a perl module (or a list of a perl module) |
104
|
|
|
|
|
|
|
This parameter helps in the coercing of XML nodes to the attribute. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=item C<xs_min_occurs> |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
This represents the minimum number of occurrences of elements in a list. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=item C<xs_max_occurs> |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
This specifies the maximum number of occurrences of elements in a list. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=item C<xs_name> |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
This is the name as it appears in the XSD |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=item C<xs_type> |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
This is the type as it appears in the XSD (this will be translated |
121
|
|
|
|
|
|
|
to perl types/modules specified by the isa property) |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=item C<xs_choice_group> |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
If a complex element has choices this records the grouping of those |
126
|
|
|
|
|
|
|
choices. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=back |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 DIAGNOSTICS |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 CONFIGURATION AND ENVIRONMENT |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 INCOMPATIBILITIES |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
There are no known bugs in this module. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Please report problems to Ivan Wills (ivan.wills@gmail.com). |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Patches are welcome. |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head1 AUTHOR |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
Ivan Wills - (ivan.wills@gmail.com) |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
Copyright (c) 2012 Ivan Wills (14 Mullion Close, Hornsby Heights, NSW Australia 2077). |
155
|
|
|
|
|
|
|
All rights reserved. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or modify it under |
158
|
|
|
|
|
|
|
the same terms as Perl itself. See L<perlartistic>. This program is |
159
|
|
|
|
|
|
|
distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
160
|
|
|
|
|
|
|
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
161
|
|
|
|
|
|
|
PARTICULAR PURPOSE. |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=cut |