develooper Front page | perl.perl5.porters | Postings from March 2006

Re: A user pragma example

Thread Previous
From:
David Nicol
Date:
March 31, 2006 15:45
Subject:
Re: A user pragma example
Message ID:
934f64a20603311545l39f94c0bn17266ececb6ffaf1@mail.gmail.com
On 3/31/06, Rafael Garcia-Suarez <rgarciasuarez@gmail.com> wrote:
> On 4/1/06, David Nicol <davidnicol@gmail.com> wrote:
> > so something like this would work?
> > sub STORE{
> >    $_[0]->{$^H{namedscope}} = $_[1]
> > };
> > sub FETCH{
> >    $_[0]->{$^H{namedscope}}
> > };
>
> I haven't tested, but I think you'll need (caller(0))[10] here instead of %^H.

yes of course.  Whoops.
WRT the previous attempt at an example,

       s/\$^H/(caller(0))[10]->/g

that's really ugly.

Could we declare, say,  %^Hints instead of %{caller(0)[10]} ?

of course its okay if it works with (caller(0))[10] -- complex things
are supposed
to be frighteningly ugly.

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About