I made this change to Text::ParseWords to accomodate an unfortunate input file.. are there any side effects to be worried about? I needed Text::ParseWords to find & return null fields. I have tested it in a couple different contexts and haven't found any unexpected horrors yet.
--- /usr/lib/perl5/5.8.0/Text/ParseWords.pm 2002-09-01 21:14:22.00 +0000000 -0700 +++ /home/selena/perl/Text/ParseWords.pm 2003-10-21 19:00:43.00 +0000000 -0700 @@ -67,6 +67,8 @@ (\Z(?!\n)|(?-x:$delimiter)|(?!^)(?=["'])) # plus EOL, delimiter, + or quote ([\000-\377]*) # the rest + | # --OR-- + ($delimiter) /x; # extended layout return() unless( $quote || length($unquoted) || length($delim) +);
In case you aren't interested in applying the patch, the whole regex - change is at the second --OR-- comment:
($quote, $quoted, undef, $unquoted, $delim, undef) = $line =~ m/^(["']) # a $quote ((?:\\.|(?!\1)[^\\])*) # and $quoted text \1 # followed by the same quote ([\000-\377]*) # and the rest | # --OR-- ^((?:\\.|[^\\"'])*?) # an $unquoted text (\Z(?!\n)|(?-x:$delimiter)|(?!^)(?=["'])) # plus EOL, delimiter, or quote ([\000-\377]*) # the rest | # --OR-- ($delimiter) /x; # extended layout

Edit by tye, mention module in title, link to module


In reply to small change to Text::ParseWords - evil consequences? by selena

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.