That pretty much says it all. Get Lexical::Alias at my web site... it'll go to CPAN soonish.

Update: apparently, the title didn't say it all. The module was "avaiable". ;) Thanks, dws and VSarkiss.

_____________________________________________________
Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who'd like a job (NYC-area)
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

Replies are listed 'Best First'.
(tye)Re: Lexical Aliases avaiable
by tye (Sage) on Jul 31, 2002 at 00:15 UTC

    japhy++ !!

    I looked at the documentation and immediately had to download the module source code to see "how did you do that". No, not the making lexical aliases (I'd already looked at Devel::LexAlias and realized that it would be a really neat module if the interface was improved a lot -- thanks much), but how you defined a single function that automatically took aliases of multiple types of arguments.

    It appears that you've used a brand new feature and the module will not work prior to Perl v5.8. It would be really nice to have this module available for versions of Perl that aren't so newly released. (:

    In porting it to pre-v5.8 I also found some bugs. But the bigger problem is deciding what interface to present when it is used in versions of Perl before v5.8.

    I'll post what I come up with if you don't beat me to it. :)

            - tye (but my friends call me "Tye")
      Yeah, I uploaded a new version that has use 5.008 because I use the new prototype \[$@%], which means "expect a scalar, array, or hash, and auto-ref it".

      As far as back-porting it, I would suggest a prototype of $$, and require the user explicitly reference the variables. The other solution is three functions, one for scalars, one for arrays, and a third for hashes; I suppose that's ok too. So let's do both:

      package Lexical::Alias; # alias() is the XS function # with a prototype of ($$) # the following are merely wrappers sub alias_s (\$\$) { goto &alias } sub alias_a (\@\@) { goto &alias } sub alias_h (\%\%) { goto &alias } 1;
      Well, that was awfully easy. But here's the deal. I'll make two functions in the XS file -- one for pre-5.8, and one for post-5.8. When the module is used, it'll alias (how funny!) alias() to the proper one.

      _____________________________________________________
      Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who'd like a job (NYC-area)
      s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

Re: Lexical Aliases available
by japhy (Canon) on Oct 12, 2002 at 19:54 UTC
    It took a while, but I've released the next version (still at the same URL) and pushed it onto CPAN (give it a day). It's nifty keen, and runs in 5.005+.

    _____________________________________________________
    Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who'd like a job (NYC-area)
    s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;