Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: Autocreating Classes

by Tanktalus (Canon)
on Oct 07, 2006 at 16:11 UTC ( #576863=note: print w/replies, xml ) Need Help??

in reply to Autocreating Classes

Lots of great ways to do it - but this smells of an XY Problem to me. As in, why does package A inspect $self? I can imagine a few cases where this may be desirable (especially with dynamic subclasses - subclasses where the name is part of the data), although even then it's kinda suspect (just put the name in the $self hash).

In general, inheritance is done by simply putting overridable actions in their own subs, and then letting each package override the appropriate methods in the appropriate ways. No introspection required. Of course, you don't need to put them in separate files, either, but that's up to you.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://576863]
Discipulus a missing semicolon after use LWP::UserAgent caused very strange behaviour and not the normal warning...
[choroba]: Yes, sometimes missing ; after the use clause just interprets the next line somehow and passes the result to the used module which could happily ignore it. Been there, seen that.
[Discipulus]: luckly the program was 20 lines!

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (10)
As of 2017-02-28 08:49 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (398 votes). Check out past polls.