[LA.pm] Classes with heterogeneous objects?
Steven Lembark
lembark at wrkhors.com
Wed Apr 4 14:43:56 PDT 2012
On Wed, 7 Mar 2012 21:14:49 -0800 (PST)
Mike MacKenzie <mackenziemikebus at yahoo.com> wrote:
>
>
> You are right of course, ref wouldn't tell you
> the underlying implementation type.__ However,
> I think Randall is still correct -- ubiquitous
> use of introspection code (aka navel gazing)
> is a real downer.__ Encapsulating the type
> determination code in a lookup table/method
> somehow would help but you'd still have the
> overhead__ -- actually more overhead
> computationally.
Simple fix: never use "ref" use "reftype" or
"blessed" instead:
use Scalar::Util qw( reftype );
given( reftype $object )
{
when( 'HASH' )
{
}
...
}
<http://www.slideshare.net/lembark/scalar-list-utils>
--
Steven Lembark 3646 Flora Pl
Workhorse Computing St Louis, MO 63110
lembark at wrkhors.com +1 888 359 3508
More information about the Losangeles-pm
mailing list