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:
Chad Granum
Date:
December 18, 2015 14:55
Subject:
Re: Proposal: Add {-as => 'new_name'} feature to Exporter.pm
Message ID:
CAJFr3ksCs=x_f0bf-mjqMxoD1yGscHK=jGQ0sCFWL3jBuHGcHQ@mail.gmail.com
>
>
> My feeling is that the syntax is a bit clunky, and it seems to
> work for importing a single name only.
>

The syntax was picked because it is consistent with what Sub::Exporter and
Exporter::Declare use. I am not saying there is not potentially a better
syntax, but I think consistency may be more important.


>
> Does it allow you to rename multiple imports? Something like:
>
>     use Foo 'name1' => {-as => 'name2'},
>             'name3' => {-as => 'name4'},
>             'name5',
>             'name6' => {-as => 'name7'};
>
> Or does that require multiple use statements?
>
> One use statement is fine, your example would work fine.


> How does it work with Exporters more advanced features, like importing
> tags, patterns, or using negations?
>
> Good point, with my current patch it will import it under the new name and
the old name if you specify this and bring the same sub in via a tag. Easy
enough to fix, I will correct that with a new patch next time I have a
chance (probably not today).


>
>
> Abigail
>

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