[tpm] How to find my class name

Tom Legrady legrady at gmail.com
Fri Mar 18 17:44:39 PDT 2011


oops, hit the return key too early ...

invoke it as testClass::getter( $mode ) and there will only be one argument

Tom

On Fri, Mar 18, 2011 at 8:43 PM, Tom Legrady <legrady at gmail.com> wrote:

> I wouldn't call this a class
>
> It doesn't ever instantiate an instance of the class -- no constructor.
>
> One doesn't access methods through the object.
>
> 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
>
> testClass::getter $mode
>
> On Fri, Mar 18, 2011 at 3:08 PM, Fulko Hew <fulko.hew at gmail.com> wrote:
>
>>
>>
>> On Fri, Mar 18, 2011 at 11:47 AM, Shlomi Fish <shlomif at iglu.org.il>
>> wrote:
>> > Hi,
>> >
>> > a few comments on your code.
>> >
>> > On Friday 18 Mar 2011 16:42:27 Fulko Hew wrote:
>> >> I have the following (simplified, and artificial) scenario:
>> >>
>> >> package testClass;
>> >
>> > 1. A package should always start with an uppercase letter.
>> >
>> > 2. You should add "use strict;" and "use warnings;" somewhere.
>>
>> I _did_ say it was an artificial scenario!
>>
>> The code I was showing was an interpretation of code
>> that is actually programatically generated by my tool,
>> but... I did take your advise.
>>
>> a) I added the strict and warning to the code generator's output,
>>     and although the generated code worked before, It did uncover
>>    some issue that makes my code generator output better
>>    ('more correct').
>>
>> b) The package names generated are actually derived from the name
>>    of a 'thing' in the source file that the code generator consumes.
>>
>>    I wanted the package name to be directly compatible with the
>>    source so that it was more intuitive to the user (relate-able).
>>
>>    After reading words around the naming convention on packages,
>>    I decided that Perl pragma safety was more important than
>>    end-user intuitiveness, and so I now up-case the first letter
>>    of the input to generate the package name.
>>
>> Fulko
>>
>>
>> _______________________________________________
>> toronto-pm mailing list
>> toronto-pm at pm.org
>> http://mail.pm.org/mailman/listinfo/toronto-pm
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20110318/c6889c5e/attachment-0001.html>


More information about the toronto-pm mailing list