Changeset 11728
- Timestamp:
- Feb 8, 2007, 5:55:22 PM (19 years ago)
- Location:
- trunk/PS-IPP-Config/lib/PS/IPP
- Files:
-
- 2 edited
-
Config.pm (modified) (9 diffs)
-
Metadata/Stats.pm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/PS-IPP-Config/lib/PS/IPP/Config.pm
r11647 r11728 1 1 # Copyright (c) 2006 Paul Price, Joshua Hoblitt 2 2 # 3 # $Id: Config.pm,v 1.2 8 2007-02-03 07:55:38 jhoblittExp $3 # $Id: Config.pm,v 1.29 2007-02-09 03:55:22 price Exp $ 4 4 5 5 package PS::IPP::Config; … … 10 10 our $VERSION = '1.00'; 11 11 12 use Carp qw( carp croak);12 use Carp qw( carp ); 13 13 use File::Spec; 14 14 use PS::IPP::Metadata::Config 0.07; … … 57 57 my $name; # Name of ipprc file 58 58 GetOptions( 'site=s' => \$name ); 59 $name = $ENV{PS_SITE} if not defined $name; 60 $name = $ENV{HOME} . '/.ipprc' if not defined $name; 61 62 open my $file, $name or croak "Unable to open ipprc file $name: $!"; 59 $name = $ENV{PS_SITE} unless defined $name; 60 $name = $ENV{HOME} . '/.ipprc' unless defined $name; 61 62 open my $file, $name; 63 unless ($file) { 64 carp "Unable to open ipprc file $name: $!"; 65 exit($PS_EXIT_CONFIG_ERROR); 66 } 63 67 my @contents = <$file>; # Contents of the ipprc file 64 68 close $file; … … 67 71 68 72 my $path = _interpolate_env(_mdLookupStr($mdc, 'PATH')); # The path 69 croak "PATH is not set in $name\n" unless defined $path; 73 unless (defined $path) { 74 carp "PATH is not set in $name\n"; 75 exit($PS_EXIT_CONFIG_ERROR); 76 } 70 77 71 78 # Interpolate environment variables in the work directory … … 96 103 my $camera_list = _mdLookupMD($self->{_ipprc}, 'CAMERAS'); # List of cameras 97 104 my $filename = _mdLookupStr($camera_list, $name); # Filename of camera configuration 98 croak "Unable to find configuration file for camera $name\n" 99 if not defined $filename; 105 unless (defined $filename) { 106 carp "Unable to find configuration file for camera $name\n"; 107 exit($PS_EXIT_CONFIG_ERROR); 108 } 100 109 101 110 my @path = split /:/, $self->{path}; # List of paths to try … … 119 128 $tries ++; 120 129 if ($tries > 4) { 121 croak "Unable to find camera configuration file $filename\n" if not $found; 130 unless ($found) { 131 carp "Unable to find camera configuration file $filename\n"; 132 exit($PS_EXIT_CONFIG_ERROR); 133 } 122 134 } 123 135 ## try again after a moment? … … 128 140 129 141 # Read the file 130 open my $file, $realfile or croak "Unable to open camera configuration file $realfile: $!"; 142 open my $file, $realfile; 143 unless ($file) { 144 carp "Unable to open camera configuration file $realfile: $!"; 145 exit($PS_EXIT_CONFIG_ERROR); 146 } 131 147 my @contents = <$file>; 132 148 close $file; … … 151 167 my $path_list = _mdLookupMD($self->{_ipprc}, 'DATAPATH'); # List of paths 152 168 my $pathname = _mdLookupStr($path_list, $name); # Path of interest 153 croak "Unable to find camera configuration file $pathname\n" if not defined $pathname; 169 unless (defined $pathname) { 170 carp "Unable to find camera configuration file $pathname\n" ; 171 exit($PS_EXIT_CONFIG_ERROR); 172 } 154 173 155 174 return $pathname; … … 274 293 TYPES: foreach my $item (@$rejection) { 275 294 if (lc($item->{name}) eq $type) { 276 croak "$name within REJECTION is not of type METADATA" unless $item->{class} eq "metadata"; 295 unless ($item->{class} eq "metadata") { 296 carp "$name within REJECTION is not of type METADATA"; 297 exit($PS_EXIT_PROG_ERROR); 298 } 277 299 my $limits = $item->{value}; # List of rejection limits 278 300 -
trunk/PS-IPP-Config/lib/PS/IPP/Metadata/Stats.pm
r9522 r11728 1 1 # Copyright (c) 2006 Paul Price, Joshua Hoblitt 2 2 # 3 # $Id: Stats.pm,v 1.1 2 2006-10-12 23:42:56price Exp $3 # $Id: Stats.pm,v 1.13 2007-02-09 03:55:22 price Exp $ 4 4 5 5 package PS::IPP::Metadata::Stats; … … 10 10 our $VERSION = '0.02'; 11 11 12 use Carp qw( carp croak);12 use Carp qw( carp ); 13 13 use Statistics::Descriptive; 14 15 use PS::IPP::Config qw( 16 $PS_EXIT_SUCCESS 17 $PS_EXIT_UNKNOWN_ERROR 18 $PS_EXIT_SYS_ERROR 19 $PS_EXIT_CONFIG_ERROR 20 $PS_EXIT_PROG_ERROR 21 $PS_EXIT_DATA_ERROR 22 $PS_EXIT_TIMEOUT_ERROR 23 ); 14 24 15 25 use base qw( Class::Accessor::Fast ); … … 233 243 } 234 244 235 croak "Unrecognised type (", $type, ") for value of ", $name, "\n"; 245 carp "Unrecognised type (", $type, ") for value of ", $name, "\n"; 246 exit($PS_EXIT_PROG_ERROR); 236 247 return; 237 248 }
Note:
See TracChangeset
for help on using the changeset viewer.
