I may have found a bug in Text::Wrap. I wrote a test to illuminate the situation (see below). Can anyone confirm that this is a problem in their environment? I haven't worked out the fix yet...
Test Script:
use Text::Wrap; local $| = 1; print "Text::Wrap info: \n"; print "Subverion: $Text::Wrap::SUBVERSION \n"; print "Version: $Text::Wrap::VERSION \n"; my @tests = ( 'the quick brown fox jumped over the lazy dog', '==============================================', ); my $columns = 28; local $Text::Wrap::columns = $columns; local $Text::Wrap::unexpand = 0; local $Text::Wrap::huge = 'wrap'; foreach my $str ( @tests ) { my $wrapped = wrap('', '', $str); chomp($wrapped); print "\n"; print "123456789|123456789|123456789|123456789|123456789|123456789|\ +n\n"; print $wrapped; print "\n-----------\n\n"; }
Results:
Text::Wrap info: Subverion: modern Version: 2012.0818 123456789|123456789|123456789|123456789|123456789|123456789| the quick brown fox jumped over the lazy dog ----------- This shouldn't happen at /usr/local/lib/perl5/5.18.0/Text/Wrap.pm line + 92.

-------------------------------------
Fred


In reply to Possible bug in Text::Wrap ??? by freddo411

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.