Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Haven't had a chance to isolate what it was working on, but FWIW I did get the following at one point:

sub findwrappoint { my ($string, $width) = @_; my $cut = 0; my $char = 0; while( $string =~ /(\e[[\d;]*m)|([^ ]+)|( +)/g ) { $3 and $char <= $width and $cut = $+[3]; $char += $1 ? 0 : $2 ? length $2 : length $3;
(above line) Use of uninitialized value in addition (+) (repeated 3x)
$char > $width and return substr( $string, 0, $cut, ''), $string; } return $string, ''; }
I'll follow up when I have better diagnostics.

Followup This string triggers the error for me:

my $string2 = qq{01:11:43:09 [CC] Roger. Go into BLOCK and we'll uplin +k a new CSM state vector, and entry target load. 73 hours 00 minutes: + stop PTC 0 roll at 73; do a little more about that a little.}; my $width = 91; my $first_indent = 15; my $next_indent = 15; say "\n$string2\n"; say ta_wrap( $string2, $width, { flindent => ' ' x $first_indent, slindent => ' ' x $next_indent } ); 01:11:43:09 [CC] Roger. Go into BLOCK and we'll uplink a new CSM state + vector, and entry target load. 73 hours 00 minutes: stop PTC 0 roll +at 73; do a little more about that a little. Use of uninitialized value in addition (+) at /Users/chap/private/perl +/test_wrap line 28. 01:11:43:09 [CC] Roger. Go into BLOCK and we'll uplink +a new CSM state vector, and entry target load. 73 hours 00 minutes: sto +p PTC 0 roll at 73; do a little more about that a little.
More followup

Here are a couple more inputs that trigger the same error. I should point out that none of these strings I've shown contains the '\e' escape sequence.

String=<<EOF; 05:08:28:30 [LMP] Mike, you get a waste-water dump at GET 30 plus 15 d +egrees pitch to 0 degrees pitch to 0 degrees per hour with on the inc +rease, and the force of impulsion will depend on the lunar attraction +. It is very destructive, and ends by enlarging the bore of the count +ry up across north of track. Over. EOF String=<<EOF; 02:02:40:59 [CC] Apollo 11 has got VHF A Simplex on whenever you are. +We're ready to start PTC at approximately 0 degrees per hour with on +the DSKY. Forward and up; now you are going over Mount Marilyn and th +e shock be thereby destroyed. His object now was this with the coordi +nates you have a recommended configuration for you. We'll just keep i +t bearable. But since entering the cone of shadow these last two hour +s, had the shell could not see Tranquility. What were you marking on? + Over. EOF
Found it

Doesn't like the word '0'. Changed

$char += $1 ? 0 : $2 ? length $2 : length $3;
to
$char += $1 ? 0 : defined $2 ? length $2 : length $3;

In reply to Re^8: Text::ANSI::Util for wrapping "colorful" text by ibm1620
in thread Text::ANSI::Util for wrapping "colorful" text by ibm1620

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (2)
As of 2024-04-26 01:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found