develooper Front page | perl.perl5.porters | Postings from July 2013

[perl #114964] [PATCH] 0d99897 Correct 'ref' func POD to fix bad behavior around 'class matching'

Thread Next
From:
Tony Cook via RT
Date:
July 24, 2013 05:13
Subject:
[perl #114964] [PATCH] 0d99897 Correct 'ref' func POD to fix bad behavior around 'class matching'
Message ID:
rt-3.6.HEAD-2552-1374642783-1564.114964-15-0@perl.org
> +If the referenced object has been blessed into a package, then that
>    package
> +name is returned instead.  But don't use that, as it's now considered
> +"bad practice".  For one reason, an object could be using a class
>    called
> +C<Regexp> or C<IO>, or even C<HASH>.  Also, c<ref> doesn't take into
>    account

Presumably C<ref> instead of c<ref>.

> +subclasses, like C<isa> does.
> +
> +Instead, use C<blessed> (in the L<Scalar::Util> module) for boolean
>    checks,
> +and C<isa> for specific class checks.  (See L<perlobj> for details
>    and a
> +C<blessed/isa> example.)
> +
>  See also L<perlref>.

I also think this could mention reftype, but it's an improvment over the
original text.

I'll apply it (with a fix for c<ref>) in a few days.

Tony

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=114964

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