Changeset 1127 in ProjectBuilder for devel/pb-modules
- Timestamp:
- Dec 21, 2010, 2:37:35 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb-modules/lib/ProjectBuilder/Base.pm
r1120 r1127 37 37 38 38 our @ISA = qw(Exporter); 39 our @EXPORT = qw(pb_mkdir_p pb_system pb_rm_rf pb_get_date pb_log pb_log_init pb_get_uri pb_get_content pb_set_content pb_display_file pb_syntax_init pb_syntax pb_temp_init pb_get_arch pb_check_requirements $pbdebug $pbLOG $pbdisplaytype $pblocale);39 our @EXPORT = qw(pb_mkdir_p pb_system pb_rm_rf pb_get_date pb_log pb_log_init pb_get_uri pb_get_content pb_set_content pb_display_file pb_syntax_init pb_syntax pb_temp_init pb_get_arch pb_check_requirements pb_check_req $pbdebug $pbLOG $pbdisplaytype $pblocale); 40 40 41 41 =pod … … 423 423 } 424 424 425 =item B<pb_check_req> 426 427 This function checks existence of a command and return its full pathname. 428 The command name is passed as first parameter. 429 The second parameter should be 0 if the command is mandatory, 1 if optional. 430 431 =cut 432 425 433 sub pb_check_req { 426 434 427 435 my $file = shift; 428 436 my $opt = shift || 1; 429 my $found = 0;437 my $found = undef; 430 438 431 439 pb_log(2,"Checking availability of $file..."); 432 440 # Check for all dirs in the PATH 433 441 foreach my $p (split(/:/,$ENV{'PATH'})) { 434 $found = 1 if (-x "$p/$file"); 435 } 436 if ($found eq 0) { 442 if (-x "$p/$file") { 443 $found = "$p/$file"; 444 last; 445 } 446 } 447 448 if (not $found) { 437 449 pb_log(2,"KO\n"); 438 450 if ($opt eq 1) { … … 443 455 } else { 444 456 pb_log(2,"OK\n"); 457 return($found"); 445 458 } 446 459 }
Note:
See TracChangeset
for help on using the changeset viewer.