IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 6, 2007, 9:36:30 AM (19 years ago)
Author:
eugene
Message:

add user option for quiet / verbose

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/detrend_stack.pl

    r13275 r13678  
    11#!/usr/bin/env perl
    22
     3use Carp;
    34use warnings;
    45use strict;
     
    3233use Pod::Usage qw( pod2usage );
    3334
    34 my ($det_id, $iter, $class_id, $det_type, $camera, $dbname, $workdir, $no_update, $no_op);
     35my ($det_id, $iter, $class_id, $det_type, $camera, $dbname, $workdir, $no_update, $no_op, $quiet);
    3536GetOptions(
    3637    'det_id|d=s'        => \$det_id,
     
    4344    'no-update'         => \$no_update,
    4445    'no-op'             => \$no_op,
     46    'quiet'             => \$quiet,
    4547) or pod2usage( 2 );
    4648
    4749pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    48 pod2usage(
    49     -msg => "Required options: --det_id --iteration --class_id --det_type --camera",
    50     -exitval => 3,
    51 ) unless defined $det_id
     50pod2usage( -msg => "Required options: --det_id --iteration --class_id --det_type --camera", -exitval => 3 )
     51    unless defined $det_id
    5252    and defined $iter
    5353    and defined $class_id
    5454    and defined $det_type
    5555    and defined $camera;
     56
     57my $verbose = 1;
     58if (defined $quiet) { $verbose = 0; }
    5659
    5760# Recipes to use as a function of detrend type
     
    8689    $command .= " -dbname $dbname" if defined $dbname;
    8790    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    88         run(command => $command, verbose => 1);
     91        run(command => $command, verbose => $verbose);
    8992    unless ($success) {
    9093        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     
    115118   
    116119    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    117         run(command => $command, verbose => 1);
     120        run(command => $command, verbose => $verbose);
    118121    unless ($success) {
    119122        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     
    149152
    150153    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    151         run(command => $command, verbose => 1);
     154        run(command => $command, verbose => $verbose);
    152155    unless ($success) {
    153156        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     
    166169    my $exit_code = shift; # Exit code to add
    167170
    168     warn($msg);
     171    carp($msg);
    169172    if ($det_id and $iter and $class_id and not $no_update) {
    170173        my $command = "$dettool -addstacked -det_id $det_id -iteration $iter -class_id $class_id -code $exit_code";
Note: See TracChangeset for help on using the changeset viewer.