diff options
author | Jesse Luehrs <doy@tozt.net> | 2011-05-02 16:12:33 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2011-05-02 16:12:33 -0500 |
commit | 774f4f10836a4e4fa82468d11d0e59730c431399 (patch) | |
tree | 6fade880894603ec075ab3719bee49e9e7cab371 /lib | |
parent | 86bd7e9d641182fcf9df4433bc788d9e25ae8698 (diff) | |
download | package-stash-774f4f10836a4e4fa82468d11d0e59730c431399.tar.gz package-stash-774f4f10836a4e4fa82468d11d0e59730c431399.zip |
better argument checking for ->new
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Package/Stash/PP.pm | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/Package/Stash/PP.pm b/lib/Package/Stash/PP.pm index 9004c5d..fdb8da9 100644 --- a/lib/Package/Stash/PP.pm +++ b/lib/Package/Stash/PP.pm @@ -26,6 +26,17 @@ This is a backend for L<Package::Stash> implemented in pure perl, for those with sub new { my $class = shift; my ($package) = @_; + + 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; |