X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FTypes%2FBase.pm;h=87906f8e572be62826138a97902b9af4612d02b2;hb=4fe418ef8e65a7277d25459d5c80341ab76dce3f;hp=3ac5423fc09a41a2c7cde149b9dd875e058d58cc;hpb=6a9158d85ae17b00a0413201d5ce88fca05c336d;p=gitmo%2FMooseX-Types.git diff --git a/lib/MooseX/Types/Base.pm b/lib/MooseX/Types/Base.pm index 3ac5423..87906f8 100644 --- a/lib/MooseX/Types/Base.pm +++ b/lib/MooseX/Types/Base.pm @@ -1,24 +1,19 @@ package MooseX::Types::Base; -our $VERSION = "0.23"; use Moose; -=head1 NAME - -MooseX::Types::Base - Type library base class - -=cut +# ABSTRACT: Type library base class use Carp::Clan qw( ^MooseX::Types ); use MooseX::Types::Util qw( filter_tags ); use Sub::Exporter qw( build_exporter ); use Moose::Util::TypeConstraints; -use namespace::clean -except => [qw( meta )]; +use namespace::autoclean; =head1 DESCRIPTION You normally won't need to interact with this class by yourself. It is -merely a collection of functionality that type libraries need to +merely a collection of functionality that type libraries need to interact with moose and the rest of the L module. =cut @@ -31,7 +26,7 @@ my $UndefMsg = q{Unable to find type '%s' in library '%s'}; =head2 import -Provides the import mechanism for your library. See +Provides the import mechanism for your library. See L for syntax details on this. =cut @@ -51,7 +46,7 @@ sub import { # determine the wrapper, -into is supported for compatibility reasons my $wrapper = $options->{ -wrapper } || 'MooseX::Types'; - $args[0]->{into} = $options->{ -into } + $args[0]->{into} = $options->{ -into } if exists $options->{ -into }; my (%ex_spec, %ex_util); @@ -65,9 +60,9 @@ sub import { my $undef_msg = sprintf($UndefMsg, $type_short, $class); # the type itself - push @{ $ex_spec{exports} }, + push @{ $ex_spec{exports} }, $type_short, - sub { + sub { bless $wrapper->type_export_generator($type_short, $type_full), 'MooseX::Types::EXPORTED_TYPE_CONSTRAINT'; }; @@ -89,13 +84,13 @@ sub import { # create S:E exporter and increase export level unless specified explicitly my $exporter = build_exporter \%ex_spec; - $options->{into_level}++ + $options->{into_level}++ unless $options->{into}; # remember requested symbols to determine what helpers to auto-export - my %was_requested = - map { ($_ => 1) } - grep { not ref } + my %was_requested = + map { ($_ => 1) } + grep { not ref } @args; # determine which additional symbols (helpers) to export along @@ -277,10 +272,6 @@ sub get_registered_role_type { L -=head1 AUTHOR - -See L. - =head1 LICENSE This program is free software; you can redistribute it and/or modify