[Pdx-pm] segfault: Carp::Heavy's fault?

Randall Hansen randall at sonofhans.net
Thu Apr 17 09:23:09 PDT 2008


On Apr 17, 2008, at 8:52 AM, Eric Wilhelm wrote:

> My Carp::Heavy (debian etch, perl 5.8.8, Carp 1.04) has a comment at
> line 51.

ah, good point.  here's the entire routine, with line numbers:

43    # Transform an argument to a function into a string.
44    sub format_arg {
45      my $arg = shift;
46      if (ref($arg)) {
47          $arg = defined($overload::VERSION) ?  
overload::StrVal($arg) : "$arg";
48      }elsif (not defined($arg)) {
49        $arg = 'undef';
50      }
51      $arg =~ s/'/\\'/g;
52      $arg = str_len_trim($arg, $MaxArgLen);
53
54      # Quote it?
55      $arg = "'$arg'" unless $arg =~ /^-?[\d.]+\z/;
56
57      # The following handling of "control chars" is direct from
58      # the original code - it is broken on Unicode though.
59      # Suggestions?
60      utf8::is_utf8($arg)
61        or $arg =~ s/([[:cntrl:]]|[[:^ascii:]])/sprintf("\ 
\x{%x}",ord($1))/eg;
62      return $arg;
63    }

r



More information about the Pdx-pm-list mailing list