- Timestamp:
- Mar 5, 2009, 11:13:29 AM (17 years ago)
- Location:
- branches/cnb_branches/cnb_branch_20090215
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ippScripts/scripts/register_imfile.pl (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/cnb_branches/cnb_branch_20090215
-
branches/cnb_branches/cnb_branch_20090215/ippScripts/scripts/register_imfile.pl
r22419 r23197 17 17 use Storable qw(freeze thaw); 18 18 use File::Basename qw( basename); 19 use IPC::Run qw( harness run ); 19 use IPC::Run; 20 use IPC::Cmd 0.36 qw( can_run ); 20 21 use PS::IPP::Config 1.01 qw( :standard ); 21 22 use PS::IPP::Metadata::Config; … … 27 28 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); 28 29 use Pod::Usage qw( pod2usage ); 30 31 # Look for programs we need 32 my $missing_tools; 33 my $regtool = can_run( 'regtool' ) or (warn "Can't find regtool" and $missing_tools = 1); 34 my $ppStats = can_run( 'ppStats' ) or (warn "Can't find ppStats" and $missing_tools = 1); 35 my $ppStatsFromMetadata = can_run( 'ppStatsFromMetadata' ) or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1); 29 36 30 37 my ($cache, $exp_id, $tmp_class_id, $tmp_exp_name, $uri, $dbname, $verbose, $no_update, $no_op, $logfile); … … 42 49 ) or pod2usage( 2 ); 43 50 51 # Unhandled exceptions should be passed on to my_die so they get pushed into the database 52 $SIG{__DIE__} = sub { die @_ if $^S; 53 my_die( $_[0], $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_UNKNOWN_ERROR ); }; 54 44 55 $ipprc->redirect_output($logfile) if $logfile; 45 56 … … 55 66 my $RECIPE = "REGISTER"; # Recipe to use for ppStats 56 67 57 # Look for programs we need58 my $missing_tools;59 my $regtool = `which regtool` or (warn "Can't find regtool" and $missing_tools = 1);60 my $ppStats = `which ppStats` or (warn "Can't find ppStats" and $missing_tools = 1);61 my $ppStatsFromMetadata = `which ppStatsFromMetadata` or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1);62 chomp $regtool;63 chomp $ppStats;64 chomp $ppStatsFromMetadata;65 66 67 68 if ($missing_tools) { 68 69 warn ("Can't find required tools"); … … 92 93 # Run ppStats 93 94 my ($in1, $out1, $err1); # Buffers for ppStats 94 my $h1 = harness \@command1, \$in1, \$out1, \$err1;95 my $h1 = IPC::Run::harness \@command1, \$in1, \$out1, \$err1; 95 96 print "[Running $command1]\n"; 96 my $result1 = run $h1;97 print $out1;98 print $err1;97 my $result1 = IPC::Run::run $h1; 98 print "STDOUT:\n$out1"; 99 print "STDERR:\n$err1"; 99 100 &my_die("Unable to perform ppStats on exposure id $exp_id: " . $h1->result(), $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $h1->result() ) unless $result1; 100 101 101 102 print "[Running " . join(' ', @command2) . "]\n"; 102 103 my ($out2, $err2); # Buffers for ppStatsFromMetadata 103 my $h2 = harness \@command2, \$out1, \$out2, \$err2;104 my $h2 = IPC::Run::harness \@command2, \$out1, \$out2, \$err2; 104 105 print "[Running $command2]\n"; 105 my $result2 = run $h2;106 print $out2;107 print $err2;106 my $result2 = IPC::Run::run $h2; 107 print "STDOUT:\n$out2"; 108 print "STDERR:\n$err2"; 108 109 &my_die("Unable to perform ppStatsFromMetadata on exposure id $exp_id: " . $h2->result(), $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $h2->result() ) unless $result2; 109 110 chomp $out2; … … 166 167 unless ($no_update) { 167 168 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 168 run(command => $command, verbose => $verbose);169 IPC::Cmd::run(command => $command, verbose => $verbose); 169 170 unless ($success) { 170 171 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); … … 187 188 return @{thaw $cmd_output}; 188 189 } else { 189 my @output = run(%p);190 my @output = IPC::Cmd::run(%p); 190 191 $c->set($p{command}, freeze \@output) if $cache; 191 192 return @output;
Note:
See TracChangeset
for help on using the changeset viewer.
