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