summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2010-11-11 22:14:56 -0600
committerJesse Luehrs <doy@tozt.net>2010-11-12 03:20:44 -0600
commit59017825dd984a30f69bec25890d1ffceaf30e04 (patch)
treebe633cf9ad0e6c511ec9b9c298178e135c924b45 /lib
parentd1f721b320d72e83c0cb24c45fe9995a6dcf29c2 (diff)
downloadpackage-stash-xs-59017825dd984a30f69bec25890d1ffceaf30e04.tar.gz
package-stash-xs-59017825dd984a30f69bec25890d1ffceaf30e04.zip
start the conversion to xs
Diffstat (limited to 'lib')
-rw-r--r--lib/Package/Stash.pm30
1 files changed, 13 insertions, 17 deletions
diff --git a/lib/Package/Stash.pm b/lib/Package/Stash.pm
index 4f1db68..871889a 100644
--- a/lib/Package/Stash.pm
+++ b/lib/Package/Stash.pm
@@ -6,6 +6,18 @@ use warnings;
use Carp qw(confess);
use Scalar::Util qw(reftype);
use Symbol;
+
+use XSLoader;
+XSLoader::load(
+ __PACKAGE__,
+ # we need to be careful not to touch $VERSION at compile time, otherwise
+ # DynaLoader will assume it's set and check against it, which will cause
+ # fail when being run in the checkout without dzil having set the actual
+ # $VERSION
+ exists $Package::Stash::{VERSION}
+ ? ${ $Package::Stash::{VERSION} } : (),
+);
+
# before 5.12, assigning to the ISA glob would make it lose its magical ->isa
# powers
use constant BROKEN_ISA_ASSIGNMENT => ($] < 5.012);
@@ -35,22 +47,6 @@ argument.
=cut
-sub new {
- my $class = shift;
- my ($package) = @_;
- my $namespace;
- {
- no strict 'refs';
- # supposedly this caused a bug in earlier perls, but I can't reproduce
- # it, so re-enabling the caching
- $namespace = \%{$package . '::'};
- }
- return bless {
- 'package' => $package,
- 'namespace' => $namespace,
- }, $class;
-}
-
=method name
Returns the name of the package that this object represents.
@@ -58,7 +54,7 @@ Returns the name of the package that this object represents.
=cut
sub name {
- return $_[0]->{package};
+ return $_[0]->{name};
}
=method namespace