oops, hit the return key too early ...<div><br></div><div>invoke it as testClass::getter( $mode ) and there will only be one argument</div><div><br></div><div>Tom<br><br><div class="gmail_quote">On Fri, Mar 18, 2011 at 8:43 PM, Tom Legrady <span dir="ltr"><<a href="mailto:legrady@gmail.com">legrady@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I wouldn't call this a class<div><br></div><div>It doesn't ever instantiate an instance of the class -- no constructor.</div>
<div><br></div><div>One doesn't access methods through the object.</div><div><br></div>
<div>It's more of a package consisting purely of a shared package variable, $classvar, and subroutines that reference it. Since you never reference the class name, invoke it as </div><div><br></div><div>testClass::getter $mode<br>
<br><div class="gmail_quote"><div><div></div><div class="h5">On Fri, Mar 18, 2011 at 3:08 PM, Fulko Hew <span dir="ltr"><<a href="mailto:fulko.hew@gmail.com" target="_blank">fulko.hew@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div class="h5">
<div><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">On Fri, Mar 18, 2011 at 11:47 AM, Shlomi Fish <<a href="mailto:shlomif@iglu.org.il" target="_blank">shlomif@iglu.org.il</a>> wrote:</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">> Hi,</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">></span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">> a few comments on your code.</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">></span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">> On Friday 18 Mar 2011 16:42:27 Fulko Hew wrote:</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">>> I have the following (simplified, and artificial) scenario:</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">>></span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">>> package testClass;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">></span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">> 1. A package should always start with an uppercase letter.</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">></span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">> 2. You should add "use strict;" and "use warnings;" somewhere.</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"></div><span style="font-family:courier new,monospace">I _did_ say it was an artificial scenario!</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">The code I was showing was an interpretation of code<br>that is actually programatically generated by my tool,<br>but... I did take</span><span style="font-family:courier new,monospace"> your advise.</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">a) I added the strict and warning to the code generator's output,</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> and although the generated code worked before, It did uncover<br> some issue that</span><span style="font-family:courier new,monospace"> makes my code generator output better<br>
('more correct').</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">b) The package names generated are actually derived from the name<br>
of a 'thing'</span><span style="font-family:courier new,monospace"> in the source file that the code generator consumes.<br><br> I wanted</span><span style="font-family:courier new,monospace"> the package name to be directly compatible with the<br>
source</span><span style="font-family:courier new,monospace"> so that it was more intuitive to the user (relate-able).<br><br> After reading words</span><span style="font-family:courier new,monospace"> around the naming convention on packages,<br>
I decided that</span><span style="font-family:courier new,monospace"> Perl pragma safety was more important than<br> end-user intuitiveness, and so I now up-case the first letter<br> of the input to generate the package name.<br>
<br>Fulko<br><br></span>
<br></div></div><div class="im">_______________________________________________<br>
toronto-pm mailing list<br>
<a href="mailto:toronto-pm@pm.org" target="_blank">toronto-pm@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/toronto-pm" target="_blank">http://mail.pm.org/mailman/listinfo/toronto-pm</a><br>
<br></div></blockquote></div><br></div>
</blockquote></div><br></div>