cvs commit: p5ee/App-Context/lib App.pm

[email protected] (Stephen Adkins)
Newsgroups perl.cvs.p5ee
Message-ID <[email protected]>
cvsuser     06/02/25 08:32:17

  Modified:    App-Context/lib App.pm
  Log:
  print 'undef' instead of '' for undefined values in traces
  
  Revision  Changes    Path
  1.20      +10 -7     p5ee/App-Context/lib/App.pm
  
  Index: App.pm
  ===================================================================
  RCS file: /cvs/public/p5ee/App-Context/lib/App.pm,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- App.pm	24 Feb 2006 19:45:34 -0000	1.19
  +++ App.pm	25 Feb 2006 16:32:17 -0000	1.20
  @@ -813,10 +813,10 @@
                   $text .= $_[$narg];
               }
               elsif (ref($_[$narg]) eq "ARRAY") {
  -                $text .= ("[" . join(",", @{$_[$narg]}) . "]");
  +                $text .= ("[" . join(",", map { defined $_ ? $_ : "undef" } @{$_[$narg]}) . "]");
               }
               elsif (ref($_[$narg]) eq "HASH") {
  -                $text .= ("{" . join(",", %{$_[$narg]}) . "}");
  +                $text .= ("{" . join(",", map { defined $_ ? $_ : "undef" } %{$_[$narg]}) . "}");
               }
               else {
                   $text .= $_[$narg];
  @@ -889,17 +889,20 @@
           for ($narg = 0; $narg <= $#_; $narg++) {
               $text .= $narg ? "," : " : ";
               $arg = $_[$narg];
  -            if (ref($arg) eq "") {
  +            if (! defined $arg) {
  +                $text .= "undef";
  +            }
  +            elsif (ref($arg) eq "") {
                   $text .= $arg;
               }
               elsif (ref($arg) eq "ARRAY") {
  -                $text .= ("[" . join(",", @$arg) . "]");
  +                $text .= ("[" . join(",", map { defined $_ ? $_ : "undef" } @$arg) . "]");
               }
               elsif (ref($arg) eq "HASH") {
  -                $text .= ("{" . join(",", %$arg) . "}");
  +                $text .= ("{" . join(",", map { defined $_ ? $_ : "undef" } %$arg) . "}");
               }
               else {
  -                $text .= $arg;
  +                $text .= defined $arg ? $arg : "undef";
               }
           }
           $text =~ s/\n/\\n/g;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.