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.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");
In reply to Re: Singleton question
by pajout
in thread Singleton question
by vippagunta
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |