| 1 | package ETLp::Types; | ||
| 2 | |||
| 3 | use MooseX::Declare; | ||
| 4 | |||
| 5 | =head1 NAME | ||
| 6 | |||
| 7 | ETLp::Types - define types for parameter checking | ||
| 8 | |||
| 9 | =head1 DESCRIPTION | ||
| 10 | |||
| 11 | Any non core Moose types must be defined before they can be used for | ||
| 12 | checks on method parameters | ||
| 13 | |||
| 14 | =cut | ||
| 15 | |||
| 16 | class ETLp::Types { | ||
| 17 | use Moose::Util::TypeConstraints; | ||
| 18 | |||
| 19 | class_type('DateTime'); | ||
| 20 | class_type('ETLp::Schema::Result::EtlpJob'); | ||
| 21 | class_type('ETLp::Schema::Result::EtlpItem'); | ||
| 22 | class_type('ETLp::Schema::Result::EtlpFileProcess'); | ||
| 23 | |||
| 24 | # Valid Oracle SQL*Loader modes | ||
| 25 | subtype 'SQLLoaderMode' | ||
| 26 | => as 'Str' | ||
| 27 | => where { /^(?:append|truncate|insert|replace)$/i }; | ||
| 28 | |||
| 29 | subtype 'PositiveInt' | ||
| 30 | => as 'Int' | ||
| 31 | => where { $_ > 0 } | ||
| 32 | => message { "The number you provided, $_, was not a positive number" }; | ||
| 33 | }; | ||
| 34 | |||
| 35 | =head1 LICENSE AND COPYRIGHT | ||
| 36 | |||
| 37 | Copyright 2010 Redbone Systems Ltd | ||
| 38 | |||
| 39 | This program is free software; you can redistribute it and/or modify it | ||
| 40 | under the terms of either: the GNU General Public License as published | ||
| 41 | by the Free Software Foundation; or the Artistic License. | ||
| 42 | |||
| 43 | The terms are in the LICENSE file that accompanies this application | ||
| 44 | |||
| 45 | =cut |