Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^3: OO-style modifiers for 'sub' ?

by Aristotle (Chancellor)
on Jan 24, 2003 at 20:43 UTC ( #229699=note: print w/replies, xml ) Need Help??


in reply to Re: Re: OO-style modifiers for 'sub' ?
in thread OO-style modifiers for 'sub' ?

I agree though that the idea runs against the essence of Perl's general lots-of-rope attitude. And indeed as dragonchild pointed out you can shorten the whole thing to UNIVERSAL::isa($self, __PACKAGE__). But even that is problematic, as some other class may well offer the same methods and signatures as yours and therefor be safe, even though it doesn't inherit from yours. See Class::Interface -- isa() Considered Harmful for a thorough discussion of the subject.

Of course, depending on your goals, it may be ok, but the caveats should be noted.

Something you may want to look into is UNIVERSAL::can() which checks if a method given by name can be called on an object reference.

Makeshifts last the longest.

Replies are listed 'Best First'.
Re: Re^3: OO-style modifiers for 'sub' ?
by Gilimanjaro (Hermit) on Jan 24, 2003 at 23:05 UTC
    Dang, that Class::Interface discussion is tasty... :)

    Once again, happy I am!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://229699]
help
Chatterbox?
[Corion]: choroba: Just imagine how bad it must be without systemd ;-D
[choroba]: but I'm not sure it's worth my time...
NodeReaper shudders
[Corion]: choroba: That chart is frustrating as it pits cold hard numbers against puttering around with an annoying problem :)
[choroba]: I only use it when I want to avoid a task...
[Corion]: choroboa: A good choice! ;)

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (10)
As of 2017-07-27 09:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (407 votes). Check out past polls.