[sf-perl] Advice on how to expose a class-wide preference

Bill Moseley moseley at hank.org
Tue Mar 18 04:44:43 PDT 2008

On Mon, Mar 17, 2008 at 11:28:54PM -0700, Anirvan Chatterjee wrote:
> I'm looking for advice on how to expose a user-settable preference
> that affects the behavior of all objects in a given class. I'm working
> on a module representing data stringifiable in multiple ways, e.g.:

Are the objects created in many different places?  That is, would it
be that difficult to just specify the type of stringification in the

    my $data = Thing->new(
        stringification_method => $config->stringification_method,

If you go the class data route I'd still copy the preference into the
object if you might ever want to change the behavior of some objects.

Bill Moseley
moseley at hank.org

More information about the SanFrancisco-pm mailing list