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

[email protected] (Stephen Adkins)
Newsgroups perl.cvs.p5ee
Message-ID <[email protected]>
cvsuser     04/11/10 07:36:37

  Modified:    App-Context/lib App.pm
  Log:
  trace_width=0 means no width. keep actual class name on line when limited by trace_width.
  
  Revision  Changes    Path
  1.14      +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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- App.pm	2 Sep 2004 20:52:24 -0000	1.13
  +++ App.pm	10 Nov 2004 15:36:37 -0000	1.14
  @@ -1,6 +1,6 @@
   
   #############################################################################
  -## $Id: App.pm,v 1.13 2004/09/02 20:52:24 spadkins Exp $
  +## $Id: App.pm,v 1.14 2004/11/10 15:36:37 spadkins Exp $
   #############################################################################
   
   package App;
  @@ -288,7 +288,7 @@
           $scope .= "," if ($scope);
           $scope .= $trace;
       }
  -    $App::trace_width = $App::options{trace_width} || 79;
  +    $App::trace_width = (defined $App::options{trace_width}) ? $App::options{trace_width} : 79;
   
       my $debug = $App::options{debug};
       if ($debug) {
  @@ -800,12 +800,15 @@
               }
           }
           #$trailer .= " [package=$package sub=$sub subroutine=$subroutine class=$class method=$method]";
  -        $text .= ")$trailer";
  -        if (length($text) > $App::trace_width) {
  -            print substr($text, 0, $App::trace_width), "\n";
  +        $text .= ")";
  +        my $trailer_len = length($trailer);
  +        if ($App::trace_width && length($text) + $trailer_len > $App::trace_width) {
  +            my $len = $App::trace_width - $trailer_len;
  +            $len = 1 if ($len < 1);
  +            print substr($text, 0, $len), $trailer, "\n";
           }
           else {
  -            print $text, "\n";
  +            print $text, $trailer, "\n";
           }
           $calldepth++;
       }
  @@ -864,7 +867,7 @@
                   $text .= $arg;
               }
           }
  -        if (length($text) > $App::trace_width) {
  +        if ($App::trace_width && length($text) > $App::trace_width) {
               print substr($text, 0, $App::trace_width), "\n";
           }
           else {
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.