The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

MooseX::Types::XMLSchema - XMLSchema compatible Moose types library

SYNOPSIS

    package My::Class;
    use Moose;
    use MooseX::Types::XMLSchema qw( :all );

    has 'string'       => ( is => 'rw', isa => 'xs:string' );
    has 'int'          => ( is => 'rw', isa => 'xs:int' );
    has 'integer'      => ( is => 'rw', isa => 'xs:integer' );
    has 'boolean'      => ( is => 'rw', isa => 'xs:boolean' );
    has 'float'        => ( is => 'rw', isa => 'xs:float' );
    has 'double'       => ( is => 'rw', isa => 'xs:double' );
    has 'decimal'      => ( is => 'rw', isa => 'xs:decimal' );

    has 'integer_co'   => ( is => 'rw', isa => 'xs:integer', coerce => 1 );
    has 'float_co'     => ( is => 'rw', isa => 'xs:float', coerce => 1 );
    has 'double_co'    => ( is => 'rw', isa => 'xs:double', coerce => 1 );
    has 'decimal_co'   => ( is => 'rw', isa => 'xs:decimal', coerce => 1 );

    has 'duration'     => ( is => 'rw', isa => 'xs:duration' );
    has 'datetime'     => ( is => 'rw', isa => 'xs:dateTime' );
    has 'time'         => ( is => 'rw', isa => 'xs:time' );
    has 'date'         => ( is => 'rw', isa => 'xs:date' );
    has 'gYearMonth'   => ( is => 'rw', isa => 'xs:gYearMonth' );
    has 'gYear'        => ( is => 'rw', isa => 'xs:gYear' );
    has 'gMonthDay'    => ( is => 'rw', isa => 'xs:gMonthDay' );
    has 'gDay'         => ( is => 'rw', isa => 'xs:gDay' );
    has 'gMonth'       => ( is => 'rw', isa => 'xs:gMonth' );

    has 'duration_dt'     => ( is => 'rw', isa => 'xs:duration', coerce => 1 );
    has 'datetime_dt'     => ( is => 'rw', isa => 'xs:dateTime', coerce => 1 );
    has 'time_dt'         => ( is => 'rw', isa => 'xs:time', coerce => 1 );
    has 'date_dt'         => ( is => 'rw', isa => 'xs:date', coerce => 1 );
    has 'gYearMonth_dt'   => ( is => 'rw', isa => 'xs:gYearMonth', coerce => 1 );
    has 'gYear_dt'        => ( is => 'rw', isa => 'xs:gYear', coerce => 1 );
    has 'gMonthDay_dt'    => ( is => 'rw', isa => 'xs:gMonthDay', coerce => 1 );
    has 'gDay_dt'         => ( is => 'rw', isa => 'xs:gDay', coerce => 1 );
    has 'gMonth_dt'       => ( is => 'rw', isa => 'xs:gMonth', coerce => 1 );

    has 'base64Binary' => ( is => 'rw', isa => 'xs:base64Binary' );
    has 'base64Binary_io' => ( is => 'rw', isa => 'xs:base64Binary', coerce => 1 );

    has 'anyURI'       => ( is => 'rw', isa => 'xs:anyURI' );
    has 'anyURI_uri'       => ( is => 'rw', isa => 'xs:anyURI', coerce => 1 );

    has 'nonPositiveInteger' => ( is => 'rw', isa => 'xs:nonPositiveInteger' );
    has 'positiveInteger'    => ( is => 'rw', isa => 'xs:positiveInteger' );
    has 'nonNegativeInteger' => ( is => 'rw', isa => 'xs:nonNegativeInteger' );
    has 'negativeInteger'    => ( is => 'rw', isa => 'xs:negativeInteger' );

Then, elsewhere:

    my $object = My::Class->new(
        string          => 'string',
        decimal         => 20.12,
        duration_dt     => DateTime->now - DateTime->(year => 1990),
        base64Binary_io => IO::File->new($0),
    );

DESCRIPTION

This class provides a number of XMLSchema compatible types for your Moose classes.

TYPES

xs:string

    has 'string'       => ( is => 'rw', isa => 'xs:string' );

A wrapper around built-in Str.

xs:integer

    has 'integer'      => ( is => 'rw', isa => 'xs:integer', coerce => 1 );

A Math::BigInt object. Set to coerce from Int.

This is defined in XSchema to be an arbitrary size integer.

xs:positiveInteger

    has 'integer' => (
        is => 'rw',
        isa => 'xs:positiveInteger',
        coerce => 1,
    );

A Math::BigInt object. Set to coerce from Int.

This is defined in XSchema to be an arbitrary size integer greater than zero.

xs:nonPositiveInteger

    has 'integer' => (
        is => 'rw',
        isa => 'xs:nonPositiveInteger',
        coerce => 1,
    );

A Math::BigInt object. Set to coerce from Int.

This is defined in XSchema to be an arbitrary size integer less than or equal to zero.

xs:negativeInteger

    has 'integer' => (
        is => 'rw',
        isa => 'xs:negativeInteger',
        coerce => 1,
    );

A Math::BigInt object. Set to coerce from Int.

This is defined in XSchema to be an arbitrary size integer less than zero.

xs:nonNegativeInteger

    has 'int' => ( is => 'rw', isa => 'xs:nonNegativeInteger' );

A Math::BigInt object. Set to coerce from Int.

This is defined in XSchema to be an arbitrary size integer greater than or equal to zero.

xs:long

    has 'long' => ( is => 'rw', isa => 'xs:long' );

A 64-bit Integer. Represented as a Math::Bigint object, but limited to the 64-bit (signed) range.

xs:unsignedLong

    has 'long' => ( is => 'rw', isa => 'xs:unsignedLong' );

A 64-bit Integer. Represented as a Math::Bigint object, but limited to the 64-bit (unsigned) range.

xs:int

    has 'int' => ( is => 'rw', isa => 'xs:int' );

A 32-bit integer. Represented natively.

xs:unsignedInt

    has 'int' => ( is => 'rw', isa => 'xs:unsignedInt' );

A 32-bit integer. Represented natively.

xs:short

    has 'int' => ( is => 'rw', isa => 'xs:short' );

A 16-bit integer. Represented natively.

xs:unsignedShort

    has 'int' => ( is => 'rw', isa => 'xs:unsignedShort' );

A 16-bit integer. Represented natively.

xs:byte

    has 'int' => ( is => 'rw', isa => 'xs:byte' );

An 8-bit integer. Represented natively.

xs:unsignedByte

    has 'int' => ( is => 'rw', isa => 'xs:unsignedByte' );

An 8-bit integer. Represented natively.

xs:boolean

    has 'boolean'      => ( is => 'rw', isa => 'xs:boolean' );

A wrapper around built-in Bool.

xs:float

    has 'float'        => ( is => 'rw', isa => 'xs:float' );

A 64-bit Float. Represented as a Math::BigFloat object, but limited to the 64-bit (unsigned) range.

xs:double

    has 'double'       => ( is => 'rw', isa => 'xs:double' );

A 64-bit Float. Represented as a Math::BigFloat object, but limited to the 64-bit (unsigned) range.

xs:decimal

    has 'decimal'      => ( is => 'rw', isa => 'xs:decimal' );

A 64-bit Float. Represented as a Math::BigFloat object, but limited to the 64-bit (unsigned) range.

xs:duration

    has 'duration'     => ( is => 'rw', isa => 'xs:duration' );
    has 'duration_dt'  => ( is => 'rw', isa => 'xs:duration', coerce => 1 );

A wrapper around Str. If you enable coerce you can pass a DateTime::Duration object.

xs:datetime

    has 'datetime'    => ( is => 'rw', isa => 'xs:dateTime' );
    has 'datetime_dt' => ( is => 'rw', isa => 'xs:dateTime', coerce => 1 );

A wrapper around Str. If you enable coerce you can pass a DateTime object.

xs:time

    has 'time'    => ( is => 'rw', isa => 'xs:time' );
    has 'time_dt' => ( is => 'rw', isa => 'xs:time', coerce => 1 );

A wrapper around Str. If you enable coerce you can pass a DateTime object.

xs:date

    has 'date'     => ( is => 'rw', isa => 'xs:date' );
    has 'date_dt'  => ( is => 'rw', isa => 'xs:date', coerce => 1 );

A wrapper around Str. If you enable coerce you can pass a DateTime object.

xs:gYearMonth

    has 'gYearMonth'    => ( is => 'rw', isa => 'xs:gYearMonth' );
    has 'gYearMonth_dt' => ( is => 'rw', isa => 'xs:gYearMonth', coerce => 1 );

A wrapper around Str. If you enable coerce you can pass a DateTime object or a ArrayRef of two integers.

xs:gYear

    has 'gYear'    => ( is => 'rw', isa => 'xs:gYear' );
    has 'gYear_dt' => ( is => 'rw', isa => 'xs:gYear', coerce => 1 );

A wrapper around Str. If you enable coerce you can pass a DateTime object.

xs:gMonthDay

    has 'gMonthDay'        => ( is => 'rw', isa => 'xs:gMonthDay' );
    has 'gMonthDay_dt' => ( is => 'rw', isa => 'xs:gMonthDay', coerce => 1 );

A wrapper around Str. If you enable coerce you can pass a DateTime object or a ArrayRef of two integers.

xs:gDay

    has 'gDay'         => ( is => 'rw', isa => 'xs:gDay' );
    has 'gDay_dt_int'  => ( is => 'rw', isa => 'xs:gDay', coerce => 1 );

A wrapper around Str. If you enable coerce you can pass a DateTime object or Int eg. 24.

xs:gMonth

    has 'gMonth'        => ( is => 'rw', isa => 'xs:gMonth', coerce => 1 );
    has 'gMonth_dt_int' => ( is => 'rw', isa => 'xs:gMonth', coerce => 1 );

A wrapper around Str. If you enable coerce you can pass a DateTime object or Int eg. 10.

xs:base64Binary

    has 'base64Binary'    => ( is => 'rw', isa => 'xs:base64Binary' );
    has 'base64Binary_io' => ( is => 'rw', isa => 'xs:base64Binary', coerce => 1 );

A wrapper around Str. If you enable coerce you can pass a IO::Handle object - the content of the file will be encoded to UTF-8 before encoding with base64.

xs:anyURI

    has 'anyURI'     => ( is => 'rw', isa => 'xs:anyURI' );
    has 'anyURI_uri' => ( is => 'rw', isa => 'xs:anyURI', coerce => 1 );

A wrapper around Str. If you enable coerce you can pass a URI object.

xs:nonPositiveInteger

    has 'nonPositiveInteger' => ( is => 'rw', isa => 'xs:nonPositiveInteger' );

A wrapper around built-in Int.

xs:negativeInteger

    has 'negativeInteger' => ( is => 'rw', isa => 'xs:negativeInteger' );

A wrapper around built-in Int.

xs:nonNegativeInteger

    has 'nonNegativeInteger' => ( is => 'rw', isa => 'xs:nonNegativeInteger' );

A wrapper around built-in Int.

xs:positiveInteger

    has 'positiveInteger'    => ( is => 'rw', isa => 'xs:positiveInteger' );

A wrapper around built-in Int.

AUTHOR

Alex J. G. Burzyński, <ajgb at cpan.org>

BUGS

Please report any bugs or feature requests to bug-moosex-types-xmlschema at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MooseX-Types-XMLSchema. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

COPYRIGHT & LICENSE

Copyright 2009 Alex J. G. Burzyński.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 735:

Non-ASCII character seen before =encoding in 'Burzyński,'. Assuming UTF-8