Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: class inheritance and new(constructor)

by shonorio (Hermit)
on Jul 16, 2006 at 23:45 UTC ( #561619=note: print w/replies, xml ) Need Help??

in reply to class inheritance and new(constructor)

I use, and recomend, Class::Std and Class::Std::Utils, or Moose than a pseudohashes OO based to implement best practices and more (and best) control over access of variables and values, constructors and destructors of my class.

Theses modules implement, and recomend you to use specials methods (BUILD and DEMOLISH) to be a constructors and destructors of your class. Theses build-in methods will manager all the class hierarchies and inheritance works.

If you don't know theses modules, I strong recomend you to take a look of them.

Solli Moreira Honorio
Sao Paulo - Brazil
  • Comment on Re: class inheritance and new(constructor)

Replies are listed 'Best First'.
Re^2: class inheritance and new(constructor)
by doom (Deacon) on Jul 17, 2006 at 07:28 UTC
    Class::Std and friends are of course the modules written by Damien Conway and endorsed in his "Perl Best Practices" book. These are one way of doing "inside-out objects", which have the advantage of encapsulated internal state (with hash based objects you can access a field of the hash directly if you feel like cheating, with inside-out objects you're forced to use the accessors).

    I haven't played with this concept much myself: they sound neat, but I think they're still a little too new. For example, there's some debate about whether "Class::Std" is really the right way to do it. I quote from the documentation for Class::InsideOut:

    * Class::Std -- Despite the name, this does not reflect currently known best practices for inside-out objects. Does not provide thread-safety with CLONE and doesn't support foreign inheritance. Has a robust inheritance/initialization system.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://561619]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2023-01-27 15:01 GMT
Find Nodes?
    Voting Booth?

    No recent polls found