Index: /trunk/ippScripts/scripts/inject.pl
===================================================================
--- /trunk/ippScripts/scripts/inject.pl	(revision 10465)
+++ /trunk/ippScripts/scripts/inject.pl	(revision 10466)
@@ -25,10 +25,10 @@
 
 pod2usage(
-    -msg => "Required options: --camera --telescope --exp_type --path",
-    -exitval => 3,
-) unless defined $camera
-    and defined $telescope
-    and defined $exp_type
-    and defined $path;
+	  -msg => "Required options: --camera --telescope --exp_type --path",
+	  -exitval => 3,
+	  ) unless scalar @ARGV == 0 or (defined $camera
+					 and defined $telescope
+					 and defined $exp_type
+					 and defined $path);
 
 my $mdcParser = PS::IPP::Metadata::Config->new;	# Metadata config parser
@@ -42,19 +42,18 @@
 die "Can't find required tools.\n" if $missing_tools;
 
+# Inject new data into the database
+if (scalar @ARGV != 0) {
+    my @classes;
+    my $imfiles;
+    if ($camera eq "MEGACAM") {
+	for (my $i = 0; $i < 36; $i++) {
+	    push @classes, sprintf("ccd%02d", $i);
+	}
+    } elsif ($camera eq "MCSHORT") {
+	@classes = ( 'ccd12', 'ccd13', 'ccd14', 'ccd21', 'ccd22', 'ccd23' );
+    } else {
+	die "Unrecognised camera name: $camera.\n";
+    }
 
-my @classes;
-my $imfiles;
-if ($camera eq "MEGACAM") {
-    for (my $i = 0; $i < 36; $i++) {
-	push @classes, sprintf("ccd%02d", $i);
-    }
-} elsif ($camera eq "MCSHORT") {
-    @classes = ( 'ccd12', 'ccd13', 'ccd14', 'ccd21', 'ccd22', 'ccd23' );
-} else {
-    die "Unrecognised camera name: $camera.\n";
-}
-
-# Inject new data into the database
-{
     foreach my $exp ( @ARGV ) {
 	my $command = "$pxinject -newExp -exp_id $exp -inst $camera -telescope $telescope -exp_type $exp_type -imfiles " . scalar @classes; # Command to run
@@ -62,5 +61,5 @@
 	    run( command => $command, verbose => 1 );
 	die "Unable to inject $exp: $error_code\n" if not $success;
-
+	
 	my @line = split(/\s+/, $$stdout_buf[0]); # The output line, containing the exposure tag
 	my $exp_tag = $line[2];	# The exposure tag
