[ale] Perl coding style

Geoffrey Myers lists at serioustechnology.com
Fri Jan 18 11:40:23 EST 2013



--
From my iPhone
Geoffrey Myers

On Jan 18, 2013, at 11:22 AM, Jerald Sheets <questy at gmail.com> wrote:

> Quoting Damian Conway's "Perl Best Practices" from O'Reilly (A MUST-OWN for any serious Perl programmer):
> 
> "All that matters is that you adopt a single, coherent style; one that works for your entire programming team. And, having agreed upon that style, that you then apply it consistently across all your development."
>  Even though he goes on to make the most minuscule of recommendations regarding large groups of text to minor ones, this remains his overarching corollary. As an addition, the following also should be folowed with great respect:
> 
> 
> 
> "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
> 
>  :)
> 

Amen.... 
> 
> I do a simulated "main()" style section at the top (right under global variable declarations) that executes all the subsequent subroutines I'm calling.  The subroutines below that are in no particular order, but are heavily documented in-line.  My module for Xymon to read tape status on a Sun StorageTek Library is a good example:  https://github.com/cvquesty/Xymon/blob/master/library.pl
> 
> A few little suggestions from my time with Perl:
> 
> The Perl Support vim plugin is AWESOME!
> http://www.vim.org/scripts/script.php?script_id=556
> 
> You just edit your template to match whatever sort of files you're working on and to reflect your personal info, etc.  When you "vi foo.pl", it'll automagically build the flower box at the top, put in the preprocessor directive, personalize the code, and everything.  My link above at GitHub reflects the nice output from that tool.
> 
> 
> That's all for now.
> 
> 
> --Jer
> 
> 
> 
> On Jan 18, 2013, at 10:21 AM, Jim Kinney <jim.kinney at gmail.com> wrote:
> 
>> It's required. Not just a "style thing".
>> 
>> Alternatively, put subroutines in external files and call them in from the top of the script. My Perl is getting quite rusty but I think it's 
>> 
>> require:<file> ;
>> 
>> On Fri, Jan 18, 2013 at 10:12 AM, Geoffrey Myers <lists at serioustechnology.com> wrote:
>>> Not trolling. I didn't want to taint the discussion by specifying my particular style. It does appear to me that most perl code I encounter has subroutines before the main code. 
>>> 
>>> 
>>> --
>>> From my iPhone
>>> Geoffrey Myers
>>> 
>>> On Jan 18, 2013, at 10:00 AM, Brandon Wood <woody at 2143.net> wrote:
>>> 
>>>>   Not sure if you're trolling or looking to have a more specific discussion as "most perl coders" is a bit of a broad statement. There are a LOT of Perl coders, many with different styles. So far as the language itself is concerned you can do it different ways; though there are suggested good practices.
>>>> 
>>>>   And yes, Perl is still alive and well and in a period of renaissance these last few years. There is an active Perl Mongers group in Atlanta that meets the first Thursday of the month. All are welcome, see http://atlanta.pm.org for more information.
>>>> 
>>>> --
>>>> Woody
>>>> 
>>>> On Fri, Jan 18, 2013 at 9:46 AM, Sam Rakowski <devnull at iamdevnull.info> wrote:
>>>>> Perl is eternal.
>>>>> Sent via BlackBerry
>>>>> _______________________________________________
>>>>> Ale mailing list
>>>>> Ale at ale.org
>>>>> http://mail.ale.org/mailman/listinfo/ale
>>>>> See JOBS, ANNOUNCE and SCHOOLS lists at
>>>>> http://mail.ale.org/mailman/listinfo
>>>> 
>>>> _______________________________________________
>>>> Ale mailing list
>>>> Ale at ale.org
>>>> http://mail.ale.org/mailman/listinfo/ale
>>>> See JOBS, ANNOUNCE and SCHOOLS lists at
>>>> http://mail.ale.org/mailman/listinfo
>>> 
>>> _______________________________________________
>>> Ale mailing list
>>> Ale at ale.org
>>> http://mail.ale.org/mailman/listinfo/ale
>>> See JOBS, ANNOUNCE and SCHOOLS lists at
>>> http://mail.ale.org/mailman/listinfo
>> 
>> 
>> 
>> -- 
>> -- 
>> James P. Kinney III
>> 
>> Every time you stop a school, you will have to build a jail. What you gain at one end you lose at the other. It's like feeding a dog on his own tail. It won't fatten the dog.
>> - Speech 11/23/1900 Mark Twain
>> 
>> http://electjimkinney.org
>> http://heretothereideas.blogspot.com/
>> _______________________________________________
>> Ale mailing list
>> Ale at ale.org
>> http://mail.ale.org/mailman/listinfo/ale
>> See JOBS, ANNOUNCE and SCHOOLS lists at
>> http://mail.ale.org/mailman/listinfo
> 
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ale.org/pipermail/ale/attachments/20130118/9720ed4b/attachment-0001.html>


More information about the Ale mailing list