KW.pm Only the Lonely #7

CGI::Pretty

  • Adds carriage returns and intentation to HTML generated by CGI.pm

         % perl -e 'use CGI qw{:standard}; print table( TR( td( "foo" ) ) );'
         <table><tr><td>foo</td></tr></table>
  • Ugh.

         % perl -e 'use CGI::Pretty qw{:standard}; print table( TR( td( "foo" ) ) );'
         <table>
                 <tr>
                         <td>
                                 foo
                         </td>
                 </tr>
         </table>
  • Better!

  • Not perfect indentation always;

  • Not useful if you don't generate HTML with CGI.pm.

<< Previous | Index | Next >> Copyright © 2005 Daniel Allen