Index: trunk/ippScripts/scripts/magic_definerun.pl
===================================================================
--- trunk/ippScripts/scripts/magic_definerun.pl	(revision 21006)
+++ trunk/ippScripts/scripts/magic_definerun.pl	(revision 23186)
@@ -25,12 +25,19 @@
 use PS::IPP::Config 1.01 qw( :standard );
 
-my $ipprc = PS::IPP::Config->new(); # IPP configuration
-
 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
 use Pod::Usage qw( pod2usage );
 
+# Look for programs we need
+my $missing_tools;
+my $magictool = can_run('magictool') or (warn "Can't find magictool" and $missing_tools = 1);
+my $difftool  = can_run('difftool') or (warn "Can't find difftool" and $missing_tools = 1);
+my $warptool  = can_run('warptool') or (warn "Can't find warptool" and $missing_tools = 1);
+if ($missing_tools) {
+    warn("Can't find required tools.");
+    exit($PS_EXIT_CONFIG_ERROR);
+}
+
 # Parse the command-line arguments
 my ($exp_id, $warp_id, $min_diff_id, $label, $workdir, $dbname, $save_temps, $verbose);
-
 GetOptions(
            'exp_id=s'        => \$exp_id,     # exposure identifier
@@ -50,15 +57,5 @@
     defined $warp_id;
 
-# $ipprc->define_camera($camera);
-
-# Look for programs we need
-my $missing_tools;
-my $magictool = can_run('magictool') or (warn "Can't find magictool" and $missing_tools = 1);
-my $difftool  = can_run('difftool') or (warn "Can't find difftool" and $missing_tools = 1);
-my $warptool  = can_run('warptool') or (warn "Can't find warptool" and $missing_tools = 1);
-if ($missing_tools) {
-    warn("Can't find required tools.");
-    exit($PS_EXIT_CONFIG_ERROR);
-}
+my $ipprc = PS::IPP::Config->new() or my_die("Unable to set up", $PS_EXIT_CONFIG_ERROR); # IPP configuration
 
 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
