Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: Object Oriented packages - classes and subroutines

by educated_foo (Vicar)
on Sep 30, 2008 at 11:55 UTC ( [id://714528]=note: print w/replies, xml ) Need Help??


in reply to Re: Object Oriented packages - classes and subroutines
in thread Object Oriented packages - classes and subroutines

If a routine is clearly not related to the object instance ($self), make it a class method (shift off $class, call the method like this: My::Class->whatever() ) instead, because.. You almost certainly will want to override one of them
This is actually really annoying as an interface, because it means that whatever can't be exported. And in my experience, for every time you want to override a class method/function, there are hundreds of times you just want to call one.

Replies are listed 'Best First'.
Re^3: Object Oriented packages - classes and subroutines
by jplindstrom (Monsignor) on Oct 06, 2008 at 14:22 UTC
    Sorry, I don't get it. Call it like this:

    my $whatever = My::Class->whatever();

    Is it the verbosity of the class name that bothers you or something else?

    /J

      Yes, it's the totally unnecessary verbosity that's extremely annoying to get rid of. That doesn't bother you?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-04-23 23:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found