Index: trunk/ippScripts/scripts/phase0_imfile.pl
===================================================================
--- trunk/ippScripts/scripts/phase0_imfile.pl	(revision 11036)
+++ trunk/ippScripts/scripts/phase0_imfile.pl	(revision 11048)
@@ -76,5 +76,5 @@
 
 # Switches for p0tool
-use constant P0TOOL_MODE => '-updateimfile'; # Mode for p0tool
+use constant P0TOOL_MODE => '-addprocessedimfile'; # Mode for p0tool
 use constant P0TOOL_EXPTAG => '-exp_tag'; # Switch to specify the exposure id
 use constant P0TOOL_CLASSID => '-class_id'; # Switch to specify the class id
@@ -110,6 +110,6 @@
         cache_run(command => $command, verbose => 1);
     unless ($success) { 
-	warn ("Unable to perform ppStats on exposure id $exp_tag: $error_code");
-	&my_die ($exp_tag, $class_id, $error_code);
+        warn ("Unable to perform ppStats on exposure id $exp_tag: $error_code");
+        &my_die ($exp_tag, $class_id, $error_code);
     }
     
@@ -118,6 +118,6 @@
     my $metadata = $mdcParser->parse(join "", @$stdout_buf); # XXX is this join necessary?
     unless ($metadata) {
-	warn ("Unable to parse metadata config doc");
-	&my_die ($exp_tag, $class_id, $PS_EXIT_PROG_ERROR);
+        warn ("Unable to parse metadata config doc");
+        &my_die ($exp_tag, $class_id, $PS_EXIT_PROG_ERROR);
     }
     my @constants = keys %{CONSTANTS()}; # List of constants to parse out
@@ -125,7 +125,7 @@
     $stats = PS::IPP::Metadata::Stats->new(\@constants, \@variables); # Stats parser
     unless ($stats->parse($metadata)) {
-	warn ("Unable to find all values");
-	&my_die ($exp_tag, $class_id, $PS_EXIT_PROG_ERROR);
-	# XXX is this a programming or a config error?
+        warn ("Unable to find all values");
+        &my_die ($exp_tag, $class_id, $PS_EXIT_PROG_ERROR);
+        # XXX is this a programming or a config error?
     }
  
@@ -133,6 +133,6 @@
     my $rnd = rand(1);
     if ($rnd > 0.5) {
-	warn ("random failure");
-	&my_die ($exp_tag, $class_id, $PS_EXIT_DATA_ERROR);
+        warn ("random failure");
+        &my_die ($exp_tag, $class_id, $PS_EXIT_DATA_ERROR);
     }
 }
@@ -144,37 +144,37 @@
 
     foreach my $constant (keys %{CONSTANTS()}) {
-	push @command, CONSTANTS->{$constant}, ($stats->data($constant))->{value};
+        push @command, CONSTANTS->{$constant}, ($stats->data($constant))->{value};
 
     }
     foreach my $variable (keys %{VARIABLES()}) {
         # Just use the mean value
-	push @command, VARIABLES->{$variable}, ($stats->data($variable))->{mean};
+        push @command, VARIABLES->{$variable}, ($stats->data($variable))->{mean};
     }
     
     push @command, P0TOOL_BG_MEAN();
     if (defined $stats->bg_mean()) {
-	push @command, $stats->bg_mean();
-    } else {
-	push @command, "NAN";
+        push @command, $stats->bg_mean();
+    } else {
+        push @command, "NAN";
     }
     push @command, P0TOOL_BG_STDEV();
     if (defined($stats->bg_stdev())) {
-	push @command, $stats->bg_stdev();
-    } else {
-	# Will not be defined if there is only a single imfile
-	push @command, 0;
+        push @command, $stats->bg_stdev();
+    } else {
+        # Will not be defined if there is only a single imfile
+        push @command, 0;
     }
     push @command,  P0TOOL_BG_MEAN_STDEV();
     if (defined $stats->bg_mean_stdev()) {
-	push @command, $stats->bg_mean_stdev();
-    } else {
-	push @command, "NAN";
+        push @command, $stats->bg_mean_stdev();
+    } else {
+        push @command, "NAN";
     }
 
     # Quote arguments with whitespace
     for (my $i = 0; $i < scalar @command; $i++) {
-	if ($command[$i] =~ /\s/) {
-	    $command[$i] = "\'$command[$i]\'";
-	}
+        if ($command[$i] =~ /\s/) {
+            $command[$i] = "\'$command[$i]\'";
+        }
     }
 
@@ -183,8 +183,8 @@
 
     unless ($success) {
-	# XXX this is tricky: if we can't run -updateimfile, can we actually set the error code?
-	# XXX if this is not a database error, it is probably a programming error (in p0tool or the passed args)
-	warn ("Unable to perform p0tool -updateimfile: $error_code");
-	&my_die ($exp_tag, $class_id, $error_code);
+        # XXX this is tricky: if we can't run -updateimfile, can we actually set the error code?
+        # XXX if this is not a database error, it is probably a programming error (in p0tool or the passed args)
+        warn ("Unable to perform p0tool -updateimfile: $error_code");
+        &my_die ($exp_tag, $class_id, $error_code);
     }
 }
@@ -210,5 +210,5 @@
     my $exit_code = $_[2];
     if ($exp_tag && $class_id) {
-	system ("$p0tool -faultimfile -exp_tag $exp_tag -class_id $class_id -code $exit_code");
+        system ("$p0tool -faultimfile -exp_tag $exp_tag -class_id $class_id -code $exit_code");
     }
     exit $exit_code;
