summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Signes <rjbs@cpan.org>2010-01-11 13:52:30 -0500
committerRafael Garcia-Suarez <rgs@consttype.org>2010-01-11 22:40:59 +0100
commita725df954c99dfa9de8864cdcc07f04fd5445563 (patch)
tree993f7e630fd721f63ff99715d6597eee02f2d054
parentad5e8af14546ce8d3ff367fe7416f10e8fc570ed (diff)
downloadperl-a725df954c99dfa9de8864cdcc07f04fd5445563.tar.gz
allow indirection between less and its hints stash name
-rw-r--r--lib/less.pm12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/less.pm b/lib/less.pm
index 970b97a80c..02ea30b9ae 100644
--- a/lib/less.pm
+++ b/lib/less.pm
@@ -14,6 +14,8 @@ sub _unpack_tags {
grep {defined} @_;
}
+sub stash_name { $_[0] }
+
sub of {
my $class = shift @_;
@@ -22,7 +24,7 @@ sub of {
my $hinthash = ( caller 0 )[10];
my %tags;
- @tags{ _unpack_tags( $hinthash->{$class} ) } = ();
+ @tags{ _unpack_tags( $hinthash->{ $class->stash_name } ) } = ();
if (@_) {
exists $tags{$_} and return !!1 for @_;
@@ -38,7 +40,7 @@ sub import {
@_ = 'please' if not @_;
my %tags;
- @tags{ _unpack_tags( @_, $^H{$class} ) } = ();
+ @tags{ _unpack_tags( @_, $^H{ $class->stash_name } ) } = ();
$^H{$class} = _pack_tags( keys %tags );
return;
@@ -54,14 +56,14 @@ sub unimport {
my $new = _pack_tags( keys %tags );
if ( not length $new ) {
- delete $^H{$class};
+ delete $^H{ $class->stash_name };
}
else {
- $^H{$class} = $new;
+ $^H{ $class->stash_name } = $new;
}
}
else {
- delete $^H{$class};
+ delete $^H{ $class->stash_name };
}
return;