Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: POD Meditation?

by temporal (Pilgrim)
on Apr 27, 2012 at 20:58 UTC ( #967719=note: print w/ replies, xml ) Need Help??


in reply to Re: POD Meditation?
in thread POD Meditation?

Wow, that is pretty neat. So the here document (creatively!) grabs the info in the POD for the perl interpreter, while POD parsers will just see the POD block. Allowing you to have a single point of change for those values.

Thanks, JavaFan!

Fun note, this code also plays holy hell with the syntax highlighter in my IDE.

Strange things are afoot at the Circle-K.


Comment on Re^2: POD Meditation?
Re^3: POD Meditation?
by JavaFan (Canon) on Apr 27, 2012 at 21:05 UTC
    Except that there isn't any POD... ;-) It's the POD parsers that think there's POD hiding inside a string (here doc).

    Fun note, this code also plays holy hell with the syntax highlighter in my IDE.
    I've never bothered with syntax highlighters, and your remark doesn't convince me I was wrong ;-)
      > Except that there isn't any POD...

      Where do you get your definition for POD from?

      Perl and POD are two different languages which can be intermingled somehow.

    • POD is what the POD-parser matches, and the input doesn't have to be a perl-source anyway.
    • And the Perl-parser doesn't know much about POD-syntax, it basically ignores any blocks between lines starting with a new statement beginning with "=" and followed by at least one word and finished by '=cut'.

      This ignored block doesn't need to be valid POD:

      > perl print "x"; =bala bala blaa asas =cut print "x"
      And the code surrounding POD doesn't need to be Perl.

      Cheers Rolf

        Where do you get your definition for POD from?
        From man perlsyn:
        PODs: Embedded Documentation
            Perl has a mechanism for intermixing documentation with source code.
            While it's expecting the beginning of a new statement, if the compiler
            encounters a line that begins with an equal sign and a word, like this
        
                =head1 Here There Be Pods!
        
            Then that text and all remaining text up through and including a line
            beginning with "=cut" will be ignored.  The format of the intervening
            text is described in perlpod.
        
        Perl and POD are two different languages which can be intermingled somehow.
        But in the snippet the OP gives, there's nothing intermingled. There's just Perl code.
        And the Perl-parser doesn't know much about POD-syntax
        I'm not claiming it does, or should be doing. But Perl does have to know where a POD section starts, and where it ends. And it knows where a POD section starts a lot better than any POD parser.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://967719]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2014-09-20 18:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (160 votes), past polls