Escape any metacharacters in the anon prefix before using it in a regex
Dave Rolsky [Wed, 20 Apr 2011 15:50:48 +0000 (10:50 -0500)]
lib/Class/MOP/Package.pm

index d3930ff..92e555e 100644 (file)
@@ -89,7 +89,7 @@ sub create {
         my $self = shift;
         no warnings 'uninitialized';
         my $prefix = $self->_anon_package_prefix;
-        $self->name =~ /^$prefix/;
+        $self->name =~ /^\Q$prefix/;
     }
 
     sub create_anon {