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

Re: A more CPANish way of making the prereq explicit? [was:Proposal: Add {-as => 'new_name'} feature to Exporter.pm]

Thread Previous | Thread Next
From:
Kent Fredric
Date:
December 24, 2015 09:20
Subject:
Re: A more CPANish way of making the prereq explicit? [was:Proposal: Add {-as => 'new_name'} feature to Exporter.pm]
Message ID:
CAATnKFBVMNN45xE3dLDYYgUVAcT4QTzWjnTVsq7awe+_OY3+NQ@mail.gmail.com
On 24 December 2015 at 21:48, Aristotle Pagaltzis <pagaltzis@gmx.de> wrote:
> That said I do not love the name and welcome
>> bike-shedding for a better one.


I think Chads' other experiment,
https://metacpan.org/pod/Symbol::Rename , is an appreciable compromise
that doesn't require gut poking.

Its essentially a nicer syntax for  doing

use Foo ":group";
BEGIN { *newname = *oldname; undef *oldname }

Except without needing arcane understanding of what that's doing that
confuses novices.

use Foo ":group"
use Symbol::Rename "oldname" => "newname";

I think the only downside of this approach is it leaves very few open
doors for a potential future that tracks imported symbols
such that "no Foo" will clean itself up.

At least with bolting it in exporter, exporter could potentially
record a map of who it gave what symbols to so that it could nuke them
again when its done.

Then again, everyone uses namespace::autoclean anyway.

-- 
Kent

KENTNL - https://metacpan.org/author/KENTNL

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