[Koha-patches] [PATCH] REFACTOR: correcting indirect object method syntax

henridamien.laurent henridamien.laurent at biblibre.com
Thu Dec 18 18:18:06 CET 2008


Andrew Moore a écrit :
> On Thu, Dec 18, 2008 at 10:56 AM, Jesse Weaver <jesse.weaver at liblime.com> wrote:
>   
>> I know that some newer parts of Koha use "CGI->new", and most of it uses
>> "new CGI".
>>
>> ->new() seems to be a bit more kosher, but this is a very rough guess. Is
>> this something we should add to the coding guidelines on the wiki?
>>     
>
> Oh, I guess I incorrectly thought it was already part of the coding
> guidelines. I personally think it should be, but I'm not sure what
> process to go through to get it on there.
>
> Here's my argument for it, borrowing heavily from Perl Best Practices:
>
>   
++
(Marc agrees 1000% with you)
> The indirect syntax: <my $q = new CGI;> will work fine for a while.
> Then, if someone creates a function named "new" in that package, or
> another package exports a function called "new", then that call can
> parse differently and call that "new" function instead of the on in
> the CGI package. That's rather unexpected "action at a distance" and
> is a hard bug to track down.
>
> I'm pretty sure that's why indirect object syntax is frowned upon in
> such large amounts of perl.
>
> So, how do we make this an official policy?
>   
step by step, like use warnings seems to be a good guess.

-- 
Henri-Damien LAURENT
BibLibre SARL
http://www.biblibre.com
Expert en Logiciels Libres pour l'info-doc
tel : +33 4 67 65 75 50





More information about the Koha-patches mailing list