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:
perl
Date:
December 18, 2015 10:30
Subject:
Re: Proposal: Add {-as => 'new_name'} feature to Exporter.pm
Message ID:
5673E028.5010603@profvince.com

>
>
> 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'},
>              'name5',
>              '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?
>

How about passing an array reference of source / destination name pairs 
instead ? Like :

     use Foo [ name1 => 'name2', name3 => 'name4', name6 => 'name7' ],
             'name5';

It seems shorter and easier to validate (unless that's already used by 
Exporter.pm, of course).


Vincent

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