From: Ricardo Signes Date: Mon, 11 Jan 2010 18:52:30 +0000 (-0500) Subject: allow indirection between less and its hints stash name X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a725df954c99dfa9de8864cdcc07f04fd5445563;p=p5sagit%2Fp5-mst-13.2.git allow indirection between less and its hints stash name --- 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;