Index: trunk/ippScripts/scripts/detrend_stack.pl
===================================================================
--- trunk/ippScripts/scripts/detrend_stack.pl	(revision 13275)
+++ trunk/ippScripts/scripts/detrend_stack.pl	(revision 13678)
@@ -1,4 +1,5 @@
 #!/usr/bin/env perl
 
+use Carp;
 use warnings;
 use strict;
@@ -32,5 +33,5 @@
 use Pod::Usage qw( pod2usage );
 
-my ($det_id, $iter, $class_id, $det_type, $camera, $dbname, $workdir, $no_update, $no_op);
+my ($det_id, $iter, $class_id, $det_type, $camera, $dbname, $workdir, $no_update, $no_op, $quiet);
 GetOptions(
     'det_id|d=s'        => \$det_id,
@@ -43,15 +44,17 @@
     'no-update'         => \$no_update,
     'no-op'             => \$no_op,
+    'quiet'             => \$quiet,
 ) or pod2usage( 2 );
 
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
-pod2usage(
-    -msg => "Required options: --det_id --iteration --class_id --det_type --camera",
-    -exitval => 3,
-) unless defined $det_id
+pod2usage( -msg => "Required options: --det_id --iteration --class_id --det_type --camera", -exitval => 3 ) 
+    unless defined $det_id
     and defined $iter
     and defined $class_id
     and defined $det_type
     and defined $camera;
+
+my $verbose = 1;
+if (defined $quiet) { $verbose = 0; }
 
 # Recipes to use as a function of detrend type
@@ -86,5 +89,5 @@
     $command .= " -dbname $dbname" if defined $dbname;
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	run(command => $command, verbose => 1);
+	run(command => $command, verbose => $verbose);
     unless ($success) {
 	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
@@ -115,5 +118,5 @@
     
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	run(command => $command, verbose => 1);
+	run(command => $command, verbose => $verbose);
     unless ($success) {
 	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
@@ -149,5 +152,5 @@
 
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	run(command => $command, verbose => 1);
+	run(command => $command, verbose => $verbose);
     unless ($success) {
 	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
@@ -166,5 +169,5 @@
     my $exit_code = shift; # Exit code to add
 
-    warn($msg);
+    carp($msg);
     if ($det_id and $iter and $class_id and not $no_update) {
 	my $command = "$dettool -addstacked -det_id $det_id -iteration $iter -class_id $class_id -code $exit_code";
