sub new {
my $class = shift;
my ($package) = @_;
- my $namespace;
+
+ if (!defined($package) || (ref($package) && ref($package) ne 'HASH')) {
+ confess "Package::Stash->new must be passed the name of the "
+ . "package to access";
+ }
+ elsif (ref($package) eq 'HASH') {
+ confess "The pure perl implementation of Package::Stash doesn't "
+ . "currently support anonymous stashes. You should install "
+ . "Package::Stash::XS";
+ }
+
return bless {
'package' => $package,
}, $class;
}
else {
my $ref = reftype($value);
- return !defined($ref) || $ref eq 'SCALAR' || $ref eq 'REF' || $ref eq 'LVALUE';
+ return !defined($ref) || $ref eq 'SCALAR' || $ref eq 'REF' || $ref eq 'LVALUE' || $ref eq 'REGEXP' || $ref eq 'VSTRING';
}
}