Suppose you have a script that creates modules, which includes something like this:
print <<POD;
=head1 NAME
name of the generated module
POD
=head1 NAME
name of the script
Guess what happens... :-)
perl
getting it right, and the POD parser not so. After all, only the former can parse Perl…Re:
cog on 2004-12-17T17:12:46
Precisely:-) You should see the result from perldoc :-)
But I decided to upload the thing anyway, just to see how the CPAN deals with it O:-)
use Filter::Indent::HereDoc;
print <<POD;
=head1 XXX
No Pod here!
POD
=head1 YYY
etc.
=cut
Re:Try indenting your here-docs
cog on 2004-12-17T17:22:20
I had thought about doing something like that, but I admit I was probably going to reinvent the wheel... again...
Nice module:-)
This is the kind of thing I'd like to see in the Perl Advent Calendar (hint, hint, coff, coff):-) Filter::Indent::HereDoc
schwern on 2004-12-18T00:19:40
Whoa, somebody implemented it!Re:Try indenting your here-docs
Aristotle on 2004-12-18T20:43:23
I don't know if that needs an entirely module…sub pod_unindent { ( local $_ = shift ) =~ s/^\s{2}//mg; $_ }
print pod_unindent <<END_POD;
=head 1 FOO
Bar. Baz.
=cut
END_POD