Index: trunk/pstamp/scripts/pstamp_job_run.pl
===================================================================
--- trunk/pstamp/scripts/pstamp_job_run.pl	(revision 20148)
+++ trunk/pstamp/scripts/pstamp_job_run.pl	(revision 20152)
@@ -13,11 +13,5 @@
 use File::Basename;
 use Digest::MD5::File qw( file_md5_hex );
-
-# values for OPTION_MASK
-# XXX put these in a module
-use constant PSTAMP_SELECT_IMAGE  => 1;
-use constant PSTAMP_SELECT_MASK   => 2;
-use constant PSTAMP_SELECT_WEIGHT => 4;
-
+use PStamp::RequestFile qw( :standard );
 
 my $verbose;
@@ -124,11 +118,24 @@
         open F, ">$reglist" or die "can't open $reglist for output";
 
-        # we are assuming an interface with ppstamp here.
+        # figure out what output images we should expect
+
+        # Note: we are assuming the contents of the filerules here.
         my @extensions = ( "fits", "mk.fits", "wt.fits");
 
-        # XXX TODO: add mask of expected file types to pstampJob so we know what to expect
-
-        my $output_mask = PSTAMP_SELECT_IMAGE;
-        my $m = 1;  # XXX we're getting a bit intimate with the bit field definitions here. do better use a hash
+        # we always require an image
+        my $output_mask = $PSTAMP_SELECT_IMAGE;
+
+        # we search the argString for -mask and -weight. 
+        # searching the arg string allows us to avoid adding a column in pstampJob
+        # XXX yeah but does this make us susceptible to user input fouling us up?
+        # For example, what if somebody sets the output base to file-mask-weight
+        # TODO: clean this up
+        $output_mask |= $PSTAMP_SELECT_MASK   if ($argString =~ /-mask/);
+        $output_mask |= $PSTAMP_SELECT_WEIGHT if ($argString =~ /-weight/);
+
+        # XXX we're getting a bit intimate with the bit field definitions here.
+        # do better use a hash
+
+        my $m = 1;
         foreach my $extension (@extensions) {
             my $do_this_one = $m & $output_mask;
@@ -141,5 +148,5 @@
             my $path  = "${outputBase}.${extension}";
 
-            # XXX is pstamp always the right file type, if not where can we get the right one?
+            # XXX is pstamp always the right file type, if not where do we get the right one?
             print F file_registration_line($filename, $path, "pstamp") . "\n";
         }
@@ -182,5 +189,7 @@
 exit $jobStatus;
 
+# create a string to be passed as input to dsreg when registering this file in a fileset
 # XXX move this to a module so it can be shared
+
 sub file_registration_line {
     my $filename = shift;
