summaryrefslogtreecommitdiffstats
path: root/lib/Package/Stash/PP.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Package/Stash/PP.pm')
-rw-r--r--lib/Package/Stash/PP.pm24
1 files changed, 9 insertions, 15 deletions
diff --git a/lib/Package/Stash/PP.pm b/lib/Package/Stash/PP.pm
index 9e53d66..dee2125 100644
--- a/lib/Package/Stash/PP.pm
+++ b/lib/Package/Stash/PP.pm
@@ -90,10 +90,6 @@ sub namespace {
}
}
-sub _is_anon {
- return !defined $_[0]->{package};
-}
-
{
my %SIGIL_MAP = (
'$' => 'SCALAR',
@@ -104,7 +100,7 @@ sub _is_anon {
);
sub _deconstruct_variable_name {
- my ($self, $variable) = @_;
+ my ($variable) = @_;
my @ret;
if (ref($variable) eq 'HASH') {
@@ -135,7 +131,6 @@ sub _is_anon {
}
sub _valid_for_type {
- my $self = shift;
my ($value, $type) = @_;
if ($type eq 'HASH' || $type eq 'ARRAY'
|| $type eq 'IO' || $type eq 'CODE') {
@@ -150,10 +145,10 @@ sub _valid_for_type {
sub add_symbol {
my ($self, $variable, $initial_value, %opts) = @_;
- my ($name, $sigil, $type) = $self->_deconstruct_variable_name($variable);
+ my ($name, $sigil, $type) = _deconstruct_variable_name($variable);
if (@_ > 2) {
- $self->_valid_for_type($initial_value, $type)
+ _valid_for_type($initial_value, $type)
|| confess "$initial_value is not of type $type";
# cheap fail-fast check for PERLDBf_SUBLINE and '&'
@@ -184,7 +179,7 @@ sub add_symbol {
*{ $self->name . '::' . $name };
}
else {
- my $undef = $self->_undef_ref_for_type($type);
+ my $undef = _undef_ref_for_type($type);
*{ $self->name . '::' . $name } = $undef;
}
}
@@ -208,13 +203,12 @@ sub add_symbol {
}
else {
return if BROKEN_ISA_ASSIGNMENT && $name eq 'ISA';
- *{ $namespace->{$name} } = $self->_undef_ref_for_type($type);
+ *{ $namespace->{$name} } = _undef_ref_for_type($type);
}
}
}
sub _undef_ref_for_type {
- my $self = shift;
my ($type) = @_;
if ($type eq 'ARRAY') {
@@ -245,7 +239,7 @@ sub remove_glob {
sub has_symbol {
my ($self, $variable) = @_;
- my ($name, $sigil, $type) = $self->_deconstruct_variable_name($variable);
+ my ($name, $sigil, $type) = _deconstruct_variable_name($variable);
my $namespace = $self->namespace;
@@ -278,7 +272,7 @@ sub has_symbol {
sub get_symbol {
my ($self, $variable, %opts) = @_;
- my ($name, $sigil, $type) = $self->_deconstruct_variable_name($variable);
+ my ($name, $sigil, $type) = _deconstruct_variable_name($variable);
my $namespace = $self->namespace;
@@ -298,7 +292,7 @@ sub get_symbol {
}
else {
if ($type eq 'CODE') {
- if (BROKEN_GLOB_ASSIGNMENT || !$self->_is_anon) {
+ if (BROKEN_GLOB_ASSIGNMENT || defined($self->{package})) {
no strict 'refs';
return \&{ $self->name . '::' . $name };
}
@@ -332,7 +326,7 @@ sub get_or_add_symbol {
sub remove_symbol {
my ($self, $variable) = @_;
- my ($name, $sigil, $type) = $self->_deconstruct_variable_name($variable);
+ my ($name, $sigil, $type) = _deconstruct_variable_name($variable);
# FIXME:
# no doubt this is grossly inefficient and