X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FTypeLibrary%2FMoose.pm;h=3b5755a1c127516fd7d12c5a85e31df9ae7edb85;hb=e211870f5f4f39a7f477a36d44b1e68e95ae2acc;hp=2254cb7f7babe9bb68c48b3d4b46d73218d90215;hpb=e9c7cea885688c43a2f3114e6f89db3c4c47caec;p=gitmo%2FMooseX-Types.git diff --git a/lib/MooseX/TypeLibrary/Moose.pm b/lib/MooseX/TypeLibrary/Moose.pm index 2254cb7..3b5755a 100644 --- a/lib/MooseX/TypeLibrary/Moose.pm +++ b/lib/MooseX/TypeLibrary/Moose.pm @@ -1,4 +1,11 @@ package MooseX::TypeLibrary::Moose; + +=head1 NAME + +MooseX::TypeLibrary::Moose - Types shipped with L + +=cut + use warnings; use strict; @@ -6,12 +13,71 @@ use MooseX::TypeLibrary; use Moose::Util::TypeConstraints (); use namespace::clean; +=head1 SYNOPSIS + + package Foo; + use Moose; + use MooseX::TypeLibrary::Moose qw( Int Str ); + use Carp qw( croak ); + + has 'name', + is => 'rw', + isa => Str; + + has 'id', + is => 'rw', + isa => Int; + + sub add { + my ($self, $x, $y) = @_; + croak 'First arg not an Int' unless is_Int($x); + croak 'Second arg not an Int' unless is_Int($y); + return $x + $y; + } + + 1; + +=head1 DESCRIPTION + +This package contains a virtual library for L that +is able to export all types known to L. See L +for general usage information. + +=cut + # all available builtin types as short and long name my %BuiltIn_Storage = map { ($_) x 2 } Moose::Util::TypeConstraints->list_all_builtin_type_constraints; +=head1 METHODS + +=head2 type_storage + +Overrides L' C to provide a hash +reference containing all built-in L types. + +=cut + # use prepopulated builtin hash as type storage sub type_storage { \%BuiltIn_Storage } +=head1 SEE ALSO + +L, +L, +L + +=head1 AUTHOR AND COPYRIGHT + +Robert 'phaylon' Sedlacek Crs@474.atE>, with many thanks to +the C<#moose> cabal on C. + +=head1 LICENSE + +This program is free software; you can redistribute it and/or modify +it under the same terms as perl itself. + +=cut + 1;