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

Re: Pod::Abstract 0.19 generating warnings on 5.11.3

Thread Previous
From:
demerphq
Date:
December 28, 2009 04:27
Subject:
Re: Pod::Abstract 0.19 generating warnings on 5.11.3
Message ID:
9b18b3110912280427k44c0dac7r9d1406c2c28d57b5@mail.gmail.com
2009/12/28  <hv@crypt.org>:
> Aristotle Pagaltzis <pagaltzis@gmx.de> wrote:
> :* Jerry D. Hedden <jdhedden@cpan.org> [2009-12-23 20:00]:
> :> No, isa() and can() should not be called as procedures. They
> :> are methods: $item->isa('thing') for example.
> :
> :Mind that you also have to wrap those in `eval` or guard them
> :with a `blessed` check. Would be nice if core shipped functions
> :to wrap up the correct behaviour concisely and efficiently…
> :related to the Scalar::Util-inspired discussion about having
> :a way to make XSUBs into ops.
>
> FWIW I have copies of this scattered around various codebases:
>    sub _isa {
>        my($val, $class) = @_;
>        eval { $val->can('isa') }
>            ? $val->isa($class)
>            : UNIVERSAL::isa($val, $class);
>    }
>
> I'd love not to need it any more, but I don't see how to get there from here.

The problem with this is that if you are going to do eval here, why
bother doing it at all?

Why not just execute the method call you are guarding in its own eval?

Also eval for this is deadly deadly slow.

cheers,
Yves




-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About