Jon Allen > Filter-Indent-HereDoc-1.00 > Filter::Indent::HereDoc

Download:
Filter-Indent-HereDoc-1.00.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 1.00   Source   Latest Release: Filter-Indent-HereDoc-1.01

NAME ^

Filter::Indent::HereDoc - allows here documents to be indented within code blocks

SYNOPSIS ^

  use Filter::Indent::HereDoc;
  {
    {
      print <<EOT;
      Hello, World!
      EOT
    }
  }
  # This will print "Hello, World!" and stop at EOT
  # even though the termination string is indented.

DESCRIPTION ^

When a 'here document' is used, the document text and the termination string must be flush with the left margin, even if the rest of the code block is indented.

Filter::Indent::HereDoc removes this restriction, and acts in a more DWIM kind of way - that if the terminator string is indented then that level of indent will apply to the whole document.

If there is no terminator string (so the here document stops at the first blank line), then enough whitespace will be stripped out so that the leftmost character of the document will be flush with the left margin, e.g.

  print <<;
       Hello,
      World!
  
  # This will print:
   Hello,
  World!

CAVEATS ^

SEE ALSO ^

Filter::Simple, http://perl.jonallen.info/modules, perlfaq4

AUTHOR ^

Jon Allen, <jj@jonallen.info>

COPYRIGHT AND LICENSE ^

Copyright 2003 by Jon Allen

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: