Fine. here then. :) This, saved as pod2include.pl, should allow you to:

=for include todo.pod

And run

pod2include.pl yourscript.pl |pod2html --title "YourScript"

Or, in fact, pipe the output to anything that expects POD (not just pod2html). It's a rough hack, but hopefully helpful.

package main; # Pod Include parser. =head1 USAGE pod2include.pl <filename> <fn_switch> = a switch that must preceed the filename for the chil +d parser. use an empty string (e.g. '') if the parser doesn't require one. =head1 POD CONVENTIONS This formatter creates a .pod file based on the original input file, b +ut with "include" interpolations. Any line that reads similar to =for include filename.pod will cause the text in C<filename.pod> to be included at that point. +Other formatters will simply skip the file. The output of this formatter is POD printed to STDOUT. This is suitab +le for piping to (for example) pod2html. =cut use strict; use warnings; use IO::File; for (@ARGV) { my $source = $_; my $IN = IO::File->new($source,'<') or die ("Can't read $source: $ +!"); my $SCRATCH = IO::File->new(">&STDOUT") or die ("Can't clone STDOU +T: $!"); my $p = Parser->new(); $p->parse_from_filehandle($IN, $SCRATCH); $IN->close; $SCRATCH->close; } #===================================================================== +========= package Parser; use base 'Pod::Parser'; sub preprocess_paragraph { my ($self, $content) = @_; my $text; if ($content =~ /^=for include (.*)/) { my $file = $1; $file =~ s/^\s+|\s+$//s; if ( -f $file ) { open my $SOURCE, '<', $file or die ("Can't source $file: $ +!"); $text = join('',<$SOURCE>)."\n\n"; close $SOURCE; } else { $text = "I<Can't find file '$file' during include>.\n\n"; } } else { $text = Pod::Parser::preprocess_paragraph(@_); } return $text; }
<-radiant.matrix->
A collection of thoughts and links from the minds of geeks
The Code that can be seen is not the true Code
I haven't found a problem yet that can't be solved by a well-placed trebuchet

In reply to Including POD files (script) by radiantmatrix
in thread A common piece of POD by blazar

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.