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

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

Thread Previous | Thread Next
December 18, 2015 10:24
Re: Proposal: Add {-as => 'new_name'} feature to
Message ID:
On Thu, Dec 17, 2015 at 12:51:38PM -0800, Chad Granum wrote:
> Several modern export tools such as Sub::Exporter and Exporter::Declare
> make it possible to rename subs that you import. They tend to use a
> consistent syntax:
> use Foo 'export_name' => {-as => 'new_name'};
> As of yet has no such capability.
> 1) Would anyone be opposed to having this functionality added? (and why?)
> 2) Does anyone oppose keeping the above syntax since it is consistent with
> everything else?
> 3) Are there any good technical reasons not to do this?
> Assuming there are no objections to the idea I would like to write a patch
> (unless someone else wants to do it).

My feeling is that the syntax is a bit clunky, and it seems to 
work for importing a single name only.

Does it allow you to rename multiple imports? Something like:

    use Foo 'name1' => {-as => 'name2'},
            'name3' => {-as => 'name4'},
            'name6' => {-as => 'name7'};

Or does that require multiple use statements? 

How does it work with Exporters more advanced features, like importing
tags, patterns, or using negations?


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About