From 59017825dd984a30f69bec25890d1ffceaf30e04 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 11 Nov 2010 22:14:56 -0600 Subject: start the conversion to xs --- lib/Package/Stash.pm | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) (limited to 'lib') 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 -- cgit v1.2.3-54-g00ecf