Index: /trunk/PS-IPP-Config/lib/PS/IPP/Config.pm
===================================================================
--- /trunk/PS-IPP-Config/lib/PS/IPP/Config.pm	(revision 11727)
+++ /trunk/PS-IPP-Config/lib/PS/IPP/Config.pm	(revision 11728)
@@ -1,5 +1,5 @@
 # Copyright (c) 2006  Paul Price, Joshua Hoblitt
 #
-# $Id: Config.pm,v 1.28 2007-02-03 07:55:38 jhoblitt Exp $
+# $Id: Config.pm,v 1.29 2007-02-09 03:55:22 price Exp $
 
 package PS::IPP::Config;
@@ -10,5 +10,5 @@
 our $VERSION = '1.00';
 
-use Carp qw( carp croak );
+use Carp qw( carp );
 use File::Spec;
 use PS::IPP::Metadata::Config 0.07;
@@ -57,8 +57,12 @@
     my $name;			# Name of ipprc file
     GetOptions( 'site=s' => \$name );
-    $name = $ENV{PS_SITE} if not defined $name;
-    $name = $ENV{HOME} . '/.ipprc' if not defined $name;
-
-    open my $file, $name or croak "Unable to open ipprc file $name: $!";
+    $name = $ENV{PS_SITE} unless defined $name;
+    $name = $ENV{HOME} . '/.ipprc' unless defined $name;
+
+    open my $file, $name;
+    unless ($file) {
+	carp "Unable to open ipprc file $name: $!";
+	exit($PS_EXIT_CONFIG_ERROR);
+    }
     my @contents = <$file>;	# Contents of the ipprc file
     close $file;
@@ -67,5 +71,8 @@
 
     my $path = _interpolate_env(_mdLookupStr($mdc, 'PATH')); # The path
-    croak "PATH is not set in $name\n" unless defined $path;
+    unless (defined $path) {
+	carp "PATH is not set in $name\n";
+	exit($PS_EXIT_CONFIG_ERROR);
+    }
 
     # Interpolate environment variables in the work directory
@@ -96,6 +103,8 @@
     my $camera_list = _mdLookupMD($self->{_ipprc}, 'CAMERAS'); # List of cameras
     my $filename = _mdLookupStr($camera_list, $name); # Filename of camera configuration
-    croak "Unable to find configuration file for camera $name\n"
-        if not defined $filename;
+    unless (defined $filename) {
+	carp "Unable to find configuration file for camera $name\n";
+	exit($PS_EXIT_CONFIG_ERROR);
+    }
 
     my @path = split /:/, $self->{path}; # List of paths to try
@@ -119,5 +128,8 @@
 	    $tries ++;
 	    if ($tries > 4) {
-		croak "Unable to find camera configuration file $filename\n" if not $found;
+		unless ($found) {
+		    carp "Unable to find camera configuration file $filename\n";
+		    exit($PS_EXIT_CONFIG_ERROR);
+		}
 	    }
 	    ## try again after a moment?
@@ -128,5 +140,9 @@
 
     # Read the file
-    open my $file, $realfile or croak "Unable to open camera configuration file $realfile: $!";
+    open my $file, $realfile;
+    unless ($file) {
+	carp "Unable to open camera configuration file $realfile: $!";
+	exit($PS_EXIT_CONFIG_ERROR);
+    }
     my @contents = <$file>;
     close $file;
@@ -151,5 +167,8 @@
     my $path_list = _mdLookupMD($self->{_ipprc}, 'DATAPATH'); # List of paths
     my $pathname = _mdLookupStr($path_list, $name); # Path of interest
-    croak "Unable to find camera configuration file $pathname\n" if not defined $pathname;
+    unless (defined $pathname) {
+	carp "Unable to find camera configuration file $pathname\n" ;
+	exit($PS_EXIT_CONFIG_ERROR);
+    }
 
     return $pathname;
@@ -274,5 +293,8 @@
   TYPES: foreach my $item (@$rejection) {
       if (lc($item->{name}) eq $type) {
-	  croak "$name within REJECTION is not of type METADATA" unless $item->{class} eq "metadata";
+	  unless ($item->{class} eq "metadata") {
+	      carp "$name within REJECTION is not of type METADATA";
+	      exit($PS_EXIT_PROG_ERROR);
+	  }
 	  my $limits = $item->{value}; # List of rejection limits
 
Index: /trunk/PS-IPP-Config/lib/PS/IPP/Metadata/Stats.pm
===================================================================
--- /trunk/PS-IPP-Config/lib/PS/IPP/Metadata/Stats.pm	(revision 11727)
+++ /trunk/PS-IPP-Config/lib/PS/IPP/Metadata/Stats.pm	(revision 11728)
@@ -1,5 +1,5 @@
 # Copyright (c) 2006  Paul Price, Joshua Hoblitt
 #
-# $Id: Stats.pm,v 1.12 2006-10-12 23:42:56 price Exp $
+# $Id: Stats.pm,v 1.13 2007-02-09 03:55:22 price Exp $
 
 package PS::IPP::Metadata::Stats;
@@ -10,6 +10,16 @@
 our $VERSION = '0.02';
 
-use Carp qw( carp croak );
+use Carp qw( carp );
 use Statistics::Descriptive;
+
+use PS::IPP::Config qw(
+    $PS_EXIT_SUCCESS
+    $PS_EXIT_UNKNOWN_ERROR
+    $PS_EXIT_SYS_ERROR
+    $PS_EXIT_CONFIG_ERROR
+    $PS_EXIT_PROG_ERROR
+    $PS_EXIT_DATA_ERROR
+    $PS_EXIT_TIMEOUT_ERROR
+    );
 
 use base qw( Class::Accessor::Fast );
@@ -233,5 +243,6 @@
     }
 
-    croak "Unrecognised type (", $type, ") for value of ", $name, "\n";
+    carp "Unrecognised type (", $type, ") for value of ", $name, "\n";
+    exit($PS_EXIT_PROG_ERROR);
     return;
 }
