Moved to MooseX-Types
phaylon [Fri, 3 Aug 2007 13:38:07 +0000 (13:38 +0000)]
Makefile.PL
lib/MooseX/Types.pm [moved from lib/MooseX/TypeLibrary.pm with 87% similarity]
lib/MooseX/Types/Base.pm [moved from lib/MooseX/TypeLibrary/Base.pm with 91% similarity]
lib/MooseX/Types/Moose.pm [moved from lib/MooseX/TypeLibrary/Moose.pm with 78% similarity]
lib/MooseX/Types/UndefinedType.pm [moved from lib/MooseX/TypeLibrary/UndefinedType.pm with 87% similarity]
lib/MooseX/Types/Util.pm [moved from lib/MooseX/TypeLibrary/Util.pm with 84% similarity]
lib/MooseX/Types/Wrapper.pm [moved from lib/MooseX/TypeLibrary/Wrapper.pm with 80% similarity]
t/10_moose-types.t
t/lib/TestLibrary.pm
t/lib/TestWrapper.pm

index 4dfa6ce..9c0f4d5 100644 (file)
@@ -4,10 +4,10 @@ use strict;
 
 use inc::Module::Install;
 
-name            q{MooseX-TypeLibrary};
+name            q{MooseX-Types};
 license         q{perl};
 author          q{Robert 'phaylon' Sedlacek <rs@474.at>};
-all_from        q{lib/MooseX/TypeLibrary.pm};
+all_from        q{lib/MooseX/Types.pm};
 
 build_requires  q{Test::More},                  '0.62';
 build_requires  q{FindBin},                     0;
similarity index 87%
rename from lib/MooseX/TypeLibrary.pm
rename to lib/MooseX/Types.pm
index 4b9da56..853b035 100644 (file)
@@ -1,8 +1,8 @@
-package MooseX::TypeLibrary;
+package MooseX::Types;
 
 =head1 NAME
 
-MooseX::TypeLibrary - Organise your Moose types in libraries
+MooseX::Types - Organise your Moose types in libraries
 
 =cut
 
@@ -11,9 +11,9 @@ MooseX::TypeLibrary - Organise your Moose types in libraries
 
 use Sub::Uplevel;
 use Moose::Util::TypeConstraints;
-use MooseX::TypeLibrary::Base           ();
-use MooseX::TypeLibrary::Util           qw( filter_tags );
-use MooseX::TypeLibrary::UndefinedType;
+use MooseX::Types::Base           ();
+use MooseX::Types::Util           qw( filter_tags );
+use MooseX::Types::UndefinedType;
 use Sub::Install                        qw( install_sub );
 use Moose;
 use namespace::clean;
@@ -31,11 +31,11 @@ my $UndefMsg = q{Action for type '%s' not yet defined in library '%s'};
   use strict;
 
   # predeclare our own types
-  use MooseX::TypeLibrary 
+  use MooseX::Types 
       -declare => [qw( PositiveInt NegativeInt )];
 
   # import builtin types
-  use MooseX::TypeLibrary::Moose 'Int';
+  use MooseX::Types::Moose 'Int';
 
   # type definition
   subtype PositiveInt, 
@@ -120,13 +120,13 @@ cannot hasn't defined any coercions will lead to a compile-time error.
 
 =head1 LIBRARY DEFINITION
 
-A MooseX::TypeLibrary is just a normal Perl module. Unlike Moose 
+A MooseX::Types is just a normal Perl module. Unlike Moose 
 itself, it does not install C<use strict> and C<use warnings> in your
 class by default, so this is up to you.
 
 The only thing a library is required to do is
 
-  use MooseX::TypeLibrary -declare => \@types;
+  use MooseX::Types -declare => \@types;
 
 with C<@types> being a list of types you wish to define in this library.
 This line will install a proper base class in your package as well as the
@@ -138,9 +138,9 @@ types.
 If you want to use Moose' built-in types (e.g. for subtyping) you will 
 want to 
 
-  use MooseX::TypeLibrary::Moose @types;
+  use MooseX::Types::Moose @types;
 
-to import the helpers from the shipped L<MooseX::TypeLibrary::Moose>
+to import the helpers from the shipped L<MooseX::Types::Moose>
 library which can export all types that come with Moose.
 
 You will have to define coercions for your types or your library won't
@@ -155,8 +155,8 @@ you want all of them, use the C<:all> tag. For example:
   use MyLibrary      ':all';
   use MyOtherLibrary qw( TypeA TypeB );
 
-MooseX::TypeLibrary comes with a library of Moose' built-in types called
-L<MooseX::TypeLibrary::Moose>.
+MooseX::Types comes with a library of Moose' built-in types called
+L<MooseX::Types::Moose>.
 
 =head1 WRAPPING A LIBRARY
 
@@ -166,7 +166,7 @@ of a set of library exports. Here is an example:
   package MyWrapper;
   use strict;
   use Class::C3;
-  use base 'MooseX::TypeLibrary::Wrapper';
+  use base 'MooseX::Types::Wrapper';
 
   sub coercion_export_generator {
       my $class = shift;
@@ -194,7 +194,7 @@ with this:
   1;
 
 The C<Moose> library name is a special shortcut for 
-L<MooseX::TypeLibrary::Moose>.
+L<MooseX::Types::Moose>.
 
 =head2 Generator methods you can overload
 
@@ -238,7 +238,7 @@ type does not yet exist.
 
 =head2 import
 
-Installs the L<MooseX::TypeLibrary::Base> class into the caller and 
+Installs the L<MooseX::Types::Base> class into the caller and 
 exports types according to the specification described in 
 L</"LIBRARY DEFINITION">. This will continue to 
 L<Moose::Util::TypeConstraints>' C<import> method to export helper
@@ -252,7 +252,7 @@ sub import {
 
     # inject base class into new library
     {   no strict 'refs';
-        unshift @{ $callee . '::ISA' }, 'MooseX::TypeLibrary::Base';
+        unshift @{ $callee . '::ISA' }, 'MooseX::Types::Base';
     }
 
     # generate predeclared type helpers
@@ -277,7 +277,7 @@ sub import {
 
 Generate a type export, e.g. C<Int()>. This will return either a
 L<Moose::Meta::TypeConstraint> object, or alternatively a
-L<MooseX::TypeLibrary::UndefinedType> object if the type was not
+L<MooseX::Types::UndefinedType> object if the type was not
 yet defined.
 
 =cut
@@ -286,7 +286,7 @@ sub type_export_generator {
     my ($class, $type, $full) = @_;
     return sub { 
         return find_type_constraint($full)
-            || MooseX::TypeLibrary::UndefinedType->new($full);
+            || MooseX::Types::UndefinedType->new($full);
     };
 }
 
@@ -334,12 +334,12 @@ sub check_export_generator {
 
 A library makes the types quasi-unique by prefixing their names with (by
 default) the library package name. If you're only using the type handler
-functions provided by MooseX::TypeLibrary, you shouldn't ever have to use
+functions provided by MooseX::Types, you shouldn't ever have to use
 a type's actual full name.
 
 =head1 SEE ALSO
 
-L<Moose>, L<Moose::Util::TypeConstraints>, L<MooseX::TypeLibrary::Moose>
+L<Moose>, L<Moose::Util::TypeConstraints>, L<MooseX::Types::Moose>
 
 =head1 AUTHOR AND COPYRIGHT
 
similarity index 91%
rename from lib/MooseX/TypeLibrary/Base.pm
rename to lib/MooseX/Types/Base.pm
index d6dda02..0bd4ee0 100644 (file)
@@ -1,8 +1,8 @@
-package MooseX::TypeLibrary::Base;
+package MooseX::Types::Base;
 
 =head1 NAME
 
-MooseX::TypeLibrary::Base - Type library base class
+MooseX::Types::Base - Type library base class
 
 =cut
 
@@ -11,7 +11,7 @@ MooseX::TypeLibrary::Base - Type library base class
 
 use Sub::Install                    qw( install_sub );
 use Carp                            qw( croak );
-use MooseX::TypeLibrary::Util       qw( filter_tags );
+use MooseX::Types::Util       qw( filter_tags );
 use Moose::Util::TypeConstraints;
 use Moose;
 use namespace::clean;
@@ -20,7 +20,7 @@ use namespace::clean;
 
 You normally won't need to interact with this class by yourself. It is
 merely a collection of functionality that type libraries need to 
-interact with moose and the rest of the L<MooseX::TypeLibrary> module.
+interact with moose and the rest of the L<MooseX::Types> module.
 
 =cut
 
@@ -33,7 +33,7 @@ my $UndefMsg = q{Unable to find type '%s' in library '%s'};
 =head2 import
 
 Provides the import mechanism for your library. See 
-L<MooseX::TypeLibrary/"LIBRARY USAGE"> for syntax details on this.
+L<MooseX::Types/"LIBRARY USAGE"> for syntax details on this.
 
 =cut
 
@@ -78,7 +78,7 @@ sub export_type_into {
     my $tobj = find_type_constraint($full);
 
     # a possible wrapper around library functionality
-    my $wrap = $args{ -wrapper } || 'MooseX::TypeLibrary';
+    my $wrap = $args{ -wrapper } || 'MooseX::Types';
 
     # install Type name constant
     install_sub({
@@ -185,7 +185,7 @@ sub type_storage {
 
 =head1 SEE ALSO
 
-L<MooseX::TypeLibrary::Moose>
+L<MooseX::Types::Moose>
 
 =head1 AUTHOR AND COPYRIGHT
 
similarity index 78%
rename from lib/MooseX/TypeLibrary/Moose.pm
rename to lib/MooseX/Types/Moose.pm
index 3b5755a..f2bca5b 100644 (file)
@@ -1,15 +1,15 @@
-package MooseX::TypeLibrary::Moose;
+package MooseX::Types::Moose;
 
 =head1 NAME
 
-MooseX::TypeLibrary::Moose - Types shipped with L<Moose>
+MooseX::Types::Moose - Types shipped with L<Moose>
 
 =cut
 
 use warnings;
 use strict;
 
-use MooseX::TypeLibrary;
+use MooseX::Types;
 use Moose::Util::TypeConstraints ();
 use namespace::clean;
 
@@ -17,7 +17,7 @@ use namespace::clean;
 
   package Foo;
   use Moose;
-  use MooseX::TypeLibrary::Moose qw( Int Str );
+  use MooseX::Types::Moose qw( Int Str );
   use Carp qw( croak );
 
   has 'name',
@@ -39,8 +39,8 @@ use namespace::clean;
 
 =head1 DESCRIPTION
 
-This package contains a virtual library for L<MooseX::TypeLibrary> that
-is able to export all types known to L<Moose>. See L<MooseX::TypeLibrary>
+This package contains a virtual library for L<MooseX::Types> that
+is able to export all types known to L<Moose>. See L<MooseX::Types>
 for general usage information.
 
 =cut
@@ -54,7 +54,7 @@ my %BuiltIn_Storage
 
 =head2 type_storage
 
-Overrides L<MooseX::TypeLibrary::Base>' C<type_storage> to provide a hash
+Overrides L<MooseX::Types::Base>' C<type_storage> to provide a hash
 reference containing all built-in L<Moose> types.
 
 =cut
@@ -64,7 +64,7 @@ sub type_storage { \%BuiltIn_Storage }
 
 =head1 SEE ALSO
 
-L<MooseX::TypeLibrary::Moose>,
+L<MooseX::Types::Moose>,
 L<Moose>, 
 L<Moose::Util::TypeConstraints>
 
similarity index 87%
rename from lib/MooseX/TypeLibrary/UndefinedType.pm
rename to lib/MooseX/Types/UndefinedType.pm
index 3bb4ca6..b35d340 100644 (file)
@@ -1,8 +1,8 @@
-package MooseX::TypeLibrary::UndefinedType;
+package MooseX::Types::UndefinedType;
 
 =head1 NAME
 
-MooseX::TypeLibrary::UndefinedType - Represents a not yet defined type
+MooseX::Types::UndefinedType - Represents a not yet defined type
 
 =cut
 
@@ -40,7 +40,7 @@ sub name { $_[0]->{name} }
 
 =head1 SEE ALSO
 
-L<MooseX::TypeLibrary::Moose>,
+L<MooseX::Types::Moose>,
 L<Moose::Util::TypeConstraints>, 
 L<Moose::Meta::TypeConstraint>
 
similarity index 84%
rename from lib/MooseX/TypeLibrary/Util.pm
rename to lib/MooseX/Types/Util.pm
index 85e780f..5bd5bcf 100644 (file)
@@ -1,8 +1,8 @@
-package MooseX::TypeLibrary::Util;
+package MooseX::Types::Util;
 
 =head1 NAME
 
-MooseX::TypeLibrary::Util - Common utility functions for the module
+MooseX::Types::Util - Common utility functions for the module
 
 =cut
 
@@ -14,7 +14,7 @@ use base 'Exporter';
 =head1 DESCRIPTION
 
 This package the exportable functions that many parts in 
-L<MooseX::TypeLibrary> might need.
+L<MooseX::Types> might need.
 
 =cut
 
@@ -45,7 +45,7 @@ sub filter_tags {
 
 =head1 SEE ALSO
 
-L<MooseX::TypeLibrary::Moose>, L<Exporter>
+L<MooseX::Types::Moose>, L<Exporter>
 
 =head1 AUTHOR AND COPYRIGHT
 
similarity index 80%
rename from lib/MooseX/TypeLibrary/Wrapper.pm
rename to lib/MooseX/Types/Wrapper.pm
index ca75c16..8a55845 100644 (file)
@@ -1,14 +1,14 @@
-package MooseX::TypeLibrary::Wrapper;
+package MooseX::Types::Wrapper;
 #use warnings;
 #use strict;
-#use base 'MooseX::TypeLibrary';
+#use base 'MooseX::Types';
 
 use Carp    qw( croak );
 use Class::Inspector;
 use Moose;
 use namespace::clean;
 
-extends 'MooseX::TypeLibrary';
+extends 'MooseX::Types';
 
 sub import {
     my ($class, @args) = @_;
@@ -20,7 +20,7 @@ sub import {
             unless ref $libraries{ $l } eq 'ARRAY';
 
         my $library_class 
-          = ($l eq 'Moose' ? 'MooseX::TypeLibrary::Moose' : $l );
+          = ($l eq 'Moose' ? 'MooseX::Types::Moose' : $l );
         require Class::Inspector->filename($library_class)
             unless Class::Inspector->loaded($library_class);
 
index c7713b8..9ba7721 100644 (file)
@@ -5,9 +5,9 @@ use strict;
 use Test::More;
 use FindBin;
 use lib "$FindBin::Bin/lib";
-use MooseX::TypeLibrary::Moose ':all';
+use MooseX::Types::Moose ':all';
 
-my @types = MooseX::TypeLibrary::Moose->type_names;
+my @types = MooseX::Types::Moose->type_names;
 
 plan tests => @types * 3;
 
index 53b01de..2eb20dd 100644 (file)
@@ -2,8 +2,8 @@ package TestLibrary;
 use warnings;
 use strict;
 
-use MooseX::TypeLibrary::Moose qw( Str ArrayRef Int );
-use MooseX::TypeLibrary
+use MooseX::Types::Moose qw( Str ArrayRef Int );
+use MooseX::Types
     -declare => [qw( NonEmptyStr IntArrayRef TwentyThree )];
 
 subtype NonEmptyStr,
index 417da25..e8e5528 100644 (file)
@@ -1,9 +1,9 @@
 package TestWrapper;
 use Moose;
 
-extends 'MooseX::TypeLibrary::Wrapper';
+extends 'MooseX::Types::Wrapper';
 #use Class::C3;
-#use base 'MooseX::TypeLibrary::Wrapper';
+#use base 'MooseX::Types::Wrapper';
 
 override type_export_generator => sub {
     my $code = super();