Ignore:
Timestamp:
May 24, 2012, 12:12:08 AM (7 years ago)
Author:
bruno
Message:
  • Fix pb_syntax, where a call with an exit of 0 was seen as false and thus lead to a value of -1. Now pb -h returns true
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb-modules/lib/ProjectBuilder/Base.pm

    r1564 r1585  
    279279sub pb_log {
    280280
    281 my $dlevel = shift;
    282 my $msg = shift;
     281my $dlevel = shift || 0;
     282my $msg = shift || "";
     283
     284$pbLOG = \*STDOUT if (not defined $pbLOG);
    283285
    284286print $pbLOG "$msg" if ($dlevel <= $pbdebug);
     
    372374sub pb_syntax {
    373375
    374 my $exit_status = shift || -1;
    375 my $verbose_level = shift || 0;
     376my $exit_status = shift;
     377my $verbose_level = shift;
    376378
    377379my $filehandle = \*STDERR;
    378380
     381# Don't do it upper as before as when the value is 0
     382# it is considered false and then exit was set to -1
     383$exit_status = -1 if (not defined $exit_status);
     384$verbose_level = 0 if (not defined $verbose_level);
     385
    379386$filehandle = \*STDOUT if ($exit_status == 0);
    380387
    381 pod2usage( { -message => $pbsynmsg,
    382              -exitval => $exit_status  ,
    383              -verbose => $verbose_level,
    384              -output  => $filehandle } );
     388pod2usage(  -message => $pbsynmsg,
     389            -exitval => $exit_status,
     390            -verbose => $verbose_level,
     391            -output  => $filehandle );
    385392}
    386393
Note: See TracChangeset for help on using the changeset viewer.