Yeah.  Let me get all philosophical here.

Using POD to comment out code is a tactical mechanism.   It has more to do
with what the programmer is thinking at the time (s)he is in the middle of
debugging. Other approaches with similar results would be to use editor
features to add '#' to the front of each line, Put the whole block inside
an 'if(0){...}',  you could also use a branch in your revision control
system and just delete the stuff you don't want.

In a real "ready for production" setting we pick a config file or command
line switches to change code behavior in planned ways.

It is common enough to see '=begin' and '=end'  used to comment out a block
but I would not regard it as a strategic (or long term) approach.
It is especially problematic if the author of the code expects users to
edit the code source at run time to enable or disable features.  If the
blocked out code has been that way for long enough it should probably just
be deleted.  If it is ever needed again you can pull it back out of your
revision control.

BTW if you use reply-all you will get the benefit of the rest of the
subscribers to the list.  I've taken the liberty of adding Perl Beginners
back into the recipients.


On Thu, Mar 30, 2017 at 11:20 AM, Sami Joseph <sami.jos...@gmail.com> wrote:

> I probably didn't explain this correctly.
>
> Someone wrote this in a group/blog and I was unable to understand what was
> so creative about using Perl PoD to comment out code ? Thats why i wanted
> help decrypting that.
>
> Thanks
>
> On Thu, Mar 30, 2017 at 8:41 AM, Chris Fedde <ch...@fedde.us> wrote:
>
>> Ahamedee1.
>>
>> The little aphorism "It's always the middle of the story" is just a
>> reminder to myself that real life situations need to be taken in context.
>> I don't think that there is anything especially smart or creative about
>> it.  Maybe I'm not understanding your context.
>>
>> chris
>>
>> On Wed, Mar 29, 2017 at 9:59 PM, Sami Joseph <sami.jos...@gmail.com>
>> wrote:
>>
>>> Hi Chris,
>>>
>>> I am only curious to understand what is so smart or creative about this
>>> story ?
>>>
>>> Thanks
>>> Ahmedee1
>>>
>>> On Mon, Mar 27, 2017 at 9:27 AM, Chris Fedde <ch...@fedde.us> wrote:
>>>
>>>> Three pieces of advice:
>>>> One: Remember the Kübler-Ross model: denial, anger, bargaining,
>>>> depression, acceptance.
>>>> Two: SQL is going to be a part of Information technology for a long
>>>> time.
>>>> Three: It's always the middle of the story.
>>>>
>>>> chris
>>>>
>>>>
>>>> On Fri, Mar 24, 2017 at 1:17 AM, Sami Joseph <sami.jos...@gmail.com>
>>>> wrote:
>>>>
>>>>>
>>>>> Hi,
>>>>>
>>>>> I am interested to understand what this guy did, but i am unable to,
>>>>> can someone please break it down to a newbie
>>>>>
>>>>> I've spent the last several days at work, trying to "take over" some
>>>>> work left behind by a departing colleague. I realized we didn't have some
>>>>> of his bash scripting in ansible or in a repo, so I decided this would be 
>>>>> a
>>>>> good opportunity to fix all of those problems. After a little while it
>>>>> became clear his script was a set of functions, run in a 
>>>>> loop-within-a-loop
>>>>> to iterate through a bunch of things. In the middle, between these two
>>>>> loops, is a pile of inline *PERL* that runs as a bash function and passes
>>>>> data back and forth in all directions. This Perl generates some dynamic 
>>>>> SQL
>>>>> commands each loop.
>>>>>
>>>>> I hate SQL.
>>>>>
>>>>> Okay... read the Perl. Now, it's been a long time and a long way since
>>>>> my last string of PERLs, so i didn't really grok 100% what I was reading,
>>>>> but I got the gist of it. Finally figured out the SQL wasn't the problem.
>>>>>
>>>>> Another day goes by, and I finally figure out his code is self
>>>>> documenting! That was what all the little bits were in the perl I didnt
>>>>> get. PerlPod. So now I can figure this out easy . Run it, read the code,
>>>>> make a change, run it... *boom* what?
>>>>>
>>>>> Nope.
>>>>>
>>>>> It took me several more hours and a few beer, and it finally clicked.
>>>>> He was using PerlPod to document out the code he didn't want to run, and
>>>>> commented out the documenting code to run the code he wanted. What looked
>>>>> commented out, wasn't, and what looked like a pile of variables being set,
>>>>> was just a bunch of commentary. He was using a documentation module for
>>>>> *flow control*.
>>>>>
>>>>> What a Hacker. Holy shit. Blew. My. Mind.
>>>>>
>>>>> I just got schooled very seriously. It's nice to know I can still
>>>>> improve *that much*, even from where I am.
>>>>>
>>>>>
>>>>> When PerlPod is used to document something, anything between control
>>>>> codes is not interpreted but treated as commented text. He would comment
>>>>> out the control codes (thus rendering the text interpretable) on the parts
>>>>> meant to run, which would differ between machines.
>>>>>
>>>>>
>>>>
>>>
>>
>

Reply via email to