Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Singleton question

by pajout (Curate)
on Nov 17, 2009 at 13:59 UTC ( [id://807694]=note: print w/replies, xml ) Need Help??


in reply to Singleton question

Yes, in my opinion. For instance (just motivation code...):

package My::Utils; my %instance; sub read_conf { #fills %instance } sub value { my ($name, $new_val) = @_; if (2 == @_) { #new value passed $instance{$name} = $new_val; } return $instance{$name}; } package My::Something use My::Utils; print My::Utils::value("something_configured");
but I prefer to really create instance of the object, and then just call $utils_instance->value("something"). Of course, it needs a little different My::Utils.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-03-29 12:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found