[ale] Perl coding style
Brandon Wood
woody at 2143.net
Fri Jan 18 11:11:26 EST 2013
As for reading material, the suggestion that Keith gave for 'Perl Best
Practices' is good; but I would to it, at the very least, Modern Perl (
http://www.onyxneon.com/books/modern_perl/index.html). One can buy a hard
copy, download the electronic versions or view it online.
There is a chapter on Functions (subroutines) for anyone interested.
On Fri, Jan 18, 2013 at 4:00 PM, Brandon Wood <woody at 2143.net> wrote:
> Fair enough; apologies for the suggestion of trolling.
>
> And no, it doesn't matter where you place the sub, at the start, in the
> middle, at the end. The parser reads the whole script through first and
> handles things from there.
>
>
>
> On Fri, Jan 18, 2013 at 3:43 PM, Charles Shapiro <hooterpincher at gmail.com>wrote:
>
>> Of course, it might have to do with geezer-coders (like me) who learned C
>> first. You have to define a subroutine before you can use it in C. You can
>> either write an explicit function prototype (e.g. "int my_dog_sex(char
>> *,int);" ) before calling your function, or you can define the whole
>> function before calling it. This makes it more convenient to put your
>> functions above your main() call, as then you didn't have to type in or
>> maintain prototype lines in addition to the functions themselves.
>>
>> -- CHS
>>
>>
>>
>> On Fri, Jan 18, 2013 at 10:25 AM, Geoffrey Myers <
>> lists at serioustechnology.com> wrote:
>>
>>> I don't think it is required. See my last post.
>>>
>>>
>>> --
>>> From my iPhone
>>> Geoffrey Myers
>>>
>>> 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
>>>
>>>
>>
>> _______________________________________________
>> 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/b4d7d744/attachment-0001.html>
More information about the Ale
mailing list