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

Re: Pod::Abstract 0.19 generating warnings on 5.11.3

Thread Previous | Thread Next
From:
Aristotle Pagaltzis
Date:
December 29, 2009 06:30
Subject:
Re: Pod::Abstract 0.19 generating warnings on 5.11.3
Message ID:
20091229142618.GA7527@klangraum.plasmasturm.org
* demerphq <demerphq@gmail.com> [2009-12-29 13:05]:
> Which check?
>
> The "role" check?
> The strict class-inheritance check?
> The "is this a valid class name (or object)" check?
> The "what base underlying class are you" check?
> Or the "which forms of dereferencing do you support" check?
>
> Consider that depending on circumstances any of the above could
> be what you want to ask, and for any given object the answers
> may vary wildly.

Yeah, but I’m not looking to cover all possible questions.

Some of those would be useful to also have, and in particular,
having a way to ask “is this something I can treat as $datatype”
would be extraordinarily helpful, but cannot currently be done in
Perl while respecting encapsulation in all cases. Consider things
like Hash::MultiValue, which gives you a blessed hashref but
*wants* you to reach inside, because that’s how it supports hash-
like access without tie or overload – the real instance data is
stored inside-out style rather than in that hash. Just looking at
the reference doesn’t tell you whether reaching inside is OK or
breaks encapsulation.

Anyway, all I want *here* is something that does the same as
calling the UNIVERSAL methods as functions, except that it should
respect overridden versions of those methods, ie.

    blessed($foo) ? $foo->can($bar) : undef
    blessed($foo) ? $foo->isa($bar) : $bar eq ref $foo

The point is being able to pass a non-reference without having to
write a mouthful of a check just to avoid a silly crash.

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>

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