handle this in package::stash
Jesse Luehrs [Tue, 6 Sep 2011 03:21:10 +0000 (22:21 -0500)]
dist.ini
lib/Class/MOP/Module.pm
t/cmop/class_errors_and_edge_cases.t
t/cmop/self_introspection.t

index 053e0d8..81d43e8 100644 (file)
--- a/dist.ini
+++ b/dist.ini
@@ -82,8 +82,8 @@ Eval::Closure               = 0.04
 List::MoreUtils             = 0.28
 MRO::Compat                 = 0.05
 Package::DeprecationManager = 0.11
-Package::Stash              = 0.21
-Package::Stash::XS          = 0.18
+Package::Stash              = 0.32
+Package::Stash::XS          = 0.24
 Params::Util                = 1.00
 Scalar::Util                = 1.19
 Sub::Exporter               = 0.980
index 5cc151a..c1a813c 100644 (file)
@@ -74,9 +74,6 @@ sub _instantiate_module {
     my($self, $version, $authority) = @_;
     my $package_name = $self->name;
 
-    _is_valid_class_name($package_name)
-        || confess "creation of $package_name failed: invalid package name";
-
     $self->add_package_symbol('$VERSION' => $version)
         if defined $version;
     $self->add_package_symbol('$AUTHORITY' => $authority)
@@ -85,18 +82,6 @@ sub _instantiate_module {
     return;
 }
 
-sub _is_valid_class_name {
-    my $class = shift;
-
-    return 0 if ref($class);
-    return 0 unless defined($class);
-    return 0 unless length($class);
-
-    return 1 if $class =~ /^\w+(?:::\w+)*$/;
-
-    return 0;
-}
-
 1;
 
 # ABSTRACT: Module Meta Object
index 02096b3..51810a3 100644 (file)
@@ -50,8 +50,7 @@ use Class::MOP;
 
     isnt( exception {
         Class::MOP::Class->create('+++');
-    }, undef, '... create requires a valid package_name parameter' );
-
+    }, qr/^\+\+\+ is not a module name/, '... create requires a valid package_name parameter' );
 }
 
 {
index dd16b19..c735f74 100644 (file)
@@ -44,8 +44,6 @@ my @class_mop_package_methods = qw(
 my @class_mop_module_methods = qw(
     _new
 
-    _is_valid_class_name
-
     _instantiate_module
 
     version authority identifier create