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 00:59
Subject:
Re: Proposal: Add {-as => 'new_name'} feature to Exporter.pm
Message ID:
CAJFr3kvGw1Jna6jC6oQGnppMgLyQk4EDF_oa2TGrv1GSFe1h=g@mail.gmail.com
I have no objections to using reftype, except that it returns undef on
non-refs which makes the conditional more complicated. Also I would be
pretty surprised if someone passed in a blessed ref to change the name of a
sub.. Perhaps it should just document that it doesn't work with a blessed
ref?

On Thu, Dec 17, 2015 at 4:39 PM, demerphq <demerphq@gmail.com> wrote:

> On 18 December 2015 at 00:14, Chad Granum <exodist7@gmail.com> wrote:
> > new patch
> >
> > On Thu, Dec 17, 2015 at 2:57 PM, Chad Granum <exodist7@gmail.com> wrote:
> >>
> >> No sooner did I send that then I realize did could do it better with 1
> >> less loop. Will attach new patch shortly.
>
> I have one concern with the patch. It uses ref($foo) eq "HASH".
>
> I think it should import reftype() from Scalar::Util and use reftype()
> instead.
>
> Or possibly be switched to use UNIVERSAL::isa($foo,"HASH").
>
> IOW, what happens if $foo is blessed?
>
> Yves
>

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