hi, sorry need to ask when is the next meeting ? or any other meetings and or events in the sfbay area, thanks<br><br><div class="gmail_quote">On Tue, Mar 18, 2008 at 1:12 PM, Steve Fink <<a href="mailto:sphink@gmail.com">sphink@gmail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">On Mon, Mar 17, 2008 at 11:28 PM, Anirvan Chatterjee<br>
<<a href="mailto:x.sfpug@chatterjee.net">x.sfpug@chatterjee.net</a>> wrote:<br>
> 1) Have a class-wide preference indicating the default style:<br>
><br>
> Class->default_string_style('normalized');<br>
><br>
> 2) Let users set their preference via a magic variable:<br>
><br>
> local $Class::default_string_style = 'normalized';<br>
><br>
> The first option seems cleaner, and easier to subclass (were that an<br>
> issue); it also allows for better error handling when the user calls<br>
> the class method. Unfortunately, setting a class-wide flag also blows<br>
> away any prior settings. Two pieces of code using the module will<br>
> necessarily overwrite each other's preferences.<br>
><br>
> Using a variable seems uglier, but allows users to safely intermix<br>
> different preference values in different contexts.<br>
<br>
</div>Just to add to the set of possibilities, you could make the settings<br>
only apply to the package that requested them. So the syntax could<br>
either be your original #1:<br>
<div class="Ih2E3d"><br>
Class->default_string_style('normalized')<br>
<br>
</div>or you could make it explicit<br>
<br>
Class->default_string_style(__PACKAGE__, 'normalized')<br>
<br>
default_string_style() would then use caller() or the passed-in<br>
package name to record who wants what, and the stringification would<br>
use caller() to decide whose setting to use.<br>
<br>
I'm not recommending it, just pointing it out.<br>
<br>
If you really wanted to be able to use local() but still have<br>
package-scoping, you could always do<br>
<br>
our $STRINGIFICATION_SETTING;<br>
local $STRINGIFICATION_SETTING = ...;<br>
<br>
and have stringification use caller() to look up that variable in its<br>
caller's package.<br>
<br>
Whee.<br>
<div><div></div><div class="Wj3C7c">_______________________________________________<br>
SanFrancisco-pm mailing list<br>
<a href="mailto:SanFrancisco-pm@pm.org">SanFrancisco-pm@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/sanfrancisco-pm" target="_blank">http://mail.pm.org/mailman/listinfo/sanfrancisco-pm</a><br>
</div></div></blockquote></div><br>