On Tue, Apr 03, 2007 at 11:44:33AM -0700, oryann9 wrote:
> In "The Perl Review" spring 07 page 10 it states:
>
> "With Perl 5.10 I can write my own lexical pragmas.
That should probably be in the future tense, since Perl 5.10 hasn't been
released yet. But it's fairly close. I suppose it's in a fairly
squelchy sort of feature slush at the moment.
But you can try these things out with Perl 5.9.4 or bleadperl (the
latest development sources) if you are feeling adventurous.
> In fact, feature was implemented this way. The
> %^H special variable lets me attach "references" to
> the optree, which I can then inspect with caller.
> Perl passes this information as a new item in the
> return list for caller: a hash reference of pragma
> settings."
>
> Questions:
> 1) What is the optree and how is it useful?
The optree is the tree of ops to which your program is compiled before
it is executed. It basically tells perl how to run your program.
> 2) What is the official name for %^H
I think %^H probably is the official name. You could also call it the
hints hash, I suppose, which rolls off the tongue a little easier.
> 3) Using caller, what is element 10 in the code below?
>I looked in Programming Perl (w/out hope) and did
>not find it.
The feature is newer than any edition of Programming Perl. There is
documentation in the bleadperl sources, but probably nowhere else.
Element 10 is a reference to a hash containing the values of %^H when
the code was compiled. This is your runtime interface to the lexical
pragma.
But this is all fairly complicated stuff and probably a little advanced
for a beginners list. You might find more joy asking on
comp.lang.perl.moderated, or perlmonks.
--
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/