NAME

Filter::BoxString - Describe your multiline strings as text boxes.

SYNOPSIS

  use Filter::BoxString;

     # Trailing whitespace preserved
     my $list = +---------------+
                | 1. Milk       |
                | 2. Eggs       |
                | 3. Apples     |
                +---------------+;

  # Trailing whitespace dropped
  my $noodles = +-----------------------+
                | Ramen
                | Shirataki
                | Soba
                | Somen
                | Udon
                +;

      my $xml = +---------------------------------------+
                |<?xml version="1.0" encoding="UTF-8"?>
                |  <item>Milk</item>
                |  <item>Eggs</item>
                |  <item>Apples</item>
                |</shopping_list>
                +---------------------------------------+;


  my $beatles = +
                | Love Me Do
                | I wanna hold your hand
                | Lucy In The Sky With Diamonds
                | Penny Lane
                +------------------------------+;

      my $sql = +
                | SELECT *
                | FROM the_table
                | WHERE this = 'that'
                | AND those = 'these'
                | ORDER BY things ASC
                +;

my $metachars = +------------------------------------------------------------+
                | \\  Quote the next metacharacter
                | ^  Match the beginning of the line
                | .  Match any character (except newline)
                | \$  Match the end of the line (or before newline at the end)
                | |  Alternation
                | () Grouping
                | [] Character class
                +------------------------------------------------------------+;

my $gibberish = +-----------------------------------+
                | +!@#\$%^&*()_|"?><{}>~=-\'/.,[]
                | +=!@#$%^&*()_-|\"':;?/>.<,}]{[><~`
                +-----------------------------------+;

DESCRIPTION

This filter allows you to describe multiline strings in your code using ASCII art style boxes. Underneath it all, this filter transforms your box-string to the equivilent here-doc.

The purpose is purely aesthetic. Please enjoy.

BUGS AND LIMITATIONS

The methodology is to capture your boxstring by matching something like " = + ... +; " which will break if your boxstring contains the sequence '+;'.

TODO

Make the delimiters as flexible as perl.

Perhaps:

my $s = qq---------------+
         | "hello world" |
         +---------------qq;

my $s = "---------------+
        | hello world+; |
        +---------------";

my $s = '------------------+
        | qq{hello world}; |
        +------------------';

AUTHOR

Dylan Doxey <dylan.doxey@gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2008 by Dylan Doxey

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.