develooper Front page | perl.perl5.porters | Postings from December 2015

Re: Proposal: Add {-as => 'new_name'} feature to Exporter.pm

Thread Previous | Thread Next
From:
Eirik Berg Hanssen
Date:
December 20, 2015 23:51
Subject:
Re: Proposal: Add {-as => 'new_name'} feature to Exporter.pm
Message ID:
CAHAeAG7AsqD9r4SWfHRhU28P0eyOu+htB9Gm+MQ0sCKJgL-vGA@mail.gmail.com
On Sun, Dec 20, 2015 at 11:07 PM, Zefram <zefram@fysh.org> wrote:

> demerphq wrote:
> >                                                              How is
> >such a facility any different from what the OP wants to add to
> >Exporter?
>
> It differs in being on the importing side.  It would be invoked by the
> module that wants the renaming, and not depend on cooperation from the
> exporting side.


  Only for sufficiently compliant exports, I suspect.

  My Test::Trap exports a new scalar and associated function on every call
to import().  Whenever the function is called, it assigns a new object to
the exported scalar through the symbol table.  You could alias the function
without breaking anything, but how would you alias the scalar, so that the
alias is also updated whenever the exported scalar is?  (Particularly
interesting when the symbol table in question is deleted, I imagine.)

  How many other exporter strategies out there would this fail to account
for, I wonder?


Eirik

Thread Previous | Thread Next


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