From a725df954c99dfa9de8864cdcc07f04fd5445563 Mon Sep 17 00:00:00 2001 From: Ricardo Signes Date: Mon, 11 Jan 2010 13:52:30 -0500 Subject: [PATCH] allow indirection between less and its hints stash name --- lib/less.pm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/less.pm b/lib/less.pm index 970b97a..02ea30b 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; -- 2.7.4