=pod
... do not be alarmed.
What happened was that I was
talking on Reddit with Masklinn about
Literate Programming, and s/he wanted to know if there were any systems other than Literate Haskell which allowed for
blog posts which are valid code. "Hrmmm," I thought, "I don't see any obstacle to (
doing that with POD... )
Comments 22
Reply
Reply
Seriously, though, the role tradition plays in computing is an interesting one. For such a young field (and one which is constantly reinventing itself), it certainly has a lot of mythology.
Reply
Reply
and add an indentation to every code block)
You could probably use it, but it wouldn't exactly be straightforward.
Reply
Reply
Reply
Or, actually, it would seem that the factorial alone would also get killed if I read my regexps right.
Reply
Reply
[1] You do not understand the idea of literate programming.
It does NOT stand for "voluble commentaries", and POD has nothing to do with it.
Moreover, a program without commentaries can be written in the "literate" style, as defined by Knuth (although that would not be natural or very useful), and vice versa, a program with tons of commentaries and code samples can have nothing to do with literal programming.
The MAIN IDEA is that you can PROGRAM IN HUMAN LANGUAGE, and your ad-hoc invented phrases become precise "variables" or, to be even more precise, MACROS that will expand to valid code.
The "untangle" program will extract this code, in correct machine order, while you are allowed to write in logical order, the order of proper thinking
[2] You miss even the basic usage of "POD" in perl.
It does not escape code unless the first symbol(s) on the line is/are blanks or tabs
So, move your code one space to the right, and POD will preserve it as code.
..without becoming a "literal programming" tool, of course
Reply
oh, well..
Reply
Reply
block in HTML. What I want to do, however, is include actual running code, for which you use =cut
The difference is easy to see. Save the following as podtest.pl:
=pod
Here is some documentation, including an example C
statement:
print "This line will not be printed.\n";
=cut
print "This line, however, will be printed.\n"; Run perl podtest.pl. Note that the second "print" statement is called, but the first one isn't. Now run pod2html podtest.pl > podtest.html and open podtest.html in your browser. You should see the following:Here is some documentation, including an example print statement:
print "This line will not be printed\n";
BTW, "literate" != "literal".
[Sorry to spam your inbox: stupid markup errors]
Reply
Leave a comment