Index: trunk/PS-IPP-Config/Build.PL
===================================================================
--- trunk/PS-IPP-Config/Build.PL	(revision 15645)
+++ trunk/PS-IPP-Config/Build.PL	(revision 15677)
@@ -13,4 +13,5 @@
         'File::Spec'                => '0.87',
         'Getopt::Long'              => '2.33',
+	'IPC::Cmd'                  => '0.36',
         'PS::IPP::Metadata::Config' => '1.00',
         'Statistics::Descriptive'   => '2.6',
Index: trunk/PS-IPP-Config/MANIFEST
===================================================================
--- trunk/PS-IPP-Config/MANIFEST	(revision 15645)
+++ trunk/PS-IPP-Config/MANIFEST	(revision 15677)
@@ -2,4 +2,5 @@
 LICENSE
 lib/PS/IPP/Config.pm
+lib/PS/IPP/Operations.pm
 lib/PS/IPP/Metadata/List.pm
 lib/PS/IPP/Metadata/Stats.pm
Index: trunk/PS-IPP-Config/lib/PS/IPP/Operations.pm
===================================================================
--- trunk/PS-IPP-Config/lib/PS/IPP/Operations.pm	(revision 15645)
+++ trunk/PS-IPP-Config/lib/PS/IPP/Operations.pm	(revision 15677)
@@ -1,5 +1,5 @@
 # Copyright (c) 2007  Paul Price
 #
-# $Id: Operations.pm,v 1.1 2007-11-17 02:35:59 price Exp $
+# $Id: Operations.pm,v 1.2 2007-11-22 00:33:39 price Exp $
 
 package PS::IPP::Operations;
@@ -12,8 +12,12 @@
 use Carp qw( carp );
 use IPC::Cmd 0.36 qw( can_run run );
+use PS::IPP::Config qw( caturi );
 
-# Allow exporting of function
+# Allow exporting of functions
 use base qw( Exporter );
-our @EXPORT_OK = qw( generate_skycells );
+our @EXPORT_OK = qw(
+		    skycell_file
+		    generate_skycells 
+		    );
 
 #$::RD_TRACE = 1;
@@ -21,13 +25,30 @@
 #use Data::Dumper;
 
-# Extract skycells to images
-sub generate_skycells {
-    my $ipprc = shift;		# Configuration object
-    my $tess_ids = shift;	# List of tessellation ids
-    my $skycell_ids = shift;	# List of skycell ids
+sub skycell_file
+{
+    my $tess_id = shift;	# Tessellation identifier
+    my $skycell_id = shift;	# Skycell identifier
     my $workdir = shift;	# Working directory
 
-    if (scalar @$tess_ids != scalar @$skycell_ids) {
-	carp "Lengths of tess_id and skycell_id don't match";
+    unless (defined $tess_id and defined $skycell_id and defined $workdir) {
+	carp "Input parameters not defined";
+	return 0;
+    }
+
+    return caturi($workdir, "tess_" . $tess_id, "sky_" . $skycell_id, $skycell_id );
+}
+
+
+
+# Extract skycells to images
+sub generate_skycells
+{
+    my $ipprc = shift;		# Configuration object
+    my $tess_id = shift;	# Tessellation identifier
+    my $skycells = shift;	# List of skycell ids
+    my $workdir = shift;	# Working directory
+
+    unless (defined $ipprc and defined $tess_id and defined $skycells and defined $workdir) {
+	carp "Input parameters not defined.";
 	return 0;
     }
@@ -38,20 +59,16 @@
 	(carp "Can't get list of tessellations." and return 0); # Hash of defined tessellations
 
-    for (my $i = 0; $i < scalar @$tess_ids; $i++) {
-	my $tess_id = $$tess_ids[$i]; # Tessellation identifier
-	my $skycell_id = $$skycell_ids[$i]; # Skycell identifier
+    ### Because DVO doesn't use psModules, it doesn't understand Nebulous --- check
+    my $scheme = file_scheme($$tessellations{$tess_id}); # The scheme, e.g., file, path, neb
+    if (defined $scheme and lc($scheme) eq 'neb') {
+	carp "Tessellation $tess_id refers to a Nebulous path: $$tessellations{$tess_id}";
+	return 0;
+    }
+    
+    my $tess_dir = $ipprc->convert_filename_absolute( $$tessellations{$tess_id} ); # Catdir for DVO
 
-	### Because DVO doesn't use psModules, it doesn't understand Nebulous --- check
-	my $scheme = file_scheme($$tessellations{$tess_id}); # The scheme, e.g., file, path, neb
-	if (defined $scheme and lc($scheme) eq 'neb') {
-	    carp "Tessellation $tess_id refers to a Nebulous path: $$tessellations{$tess_id}";
-	    return 0;
-	}
-
-	my $tess_dir = $ipprc->convert_filename_absolute( $$tessellations{$tess_id} ); # Catdir for DVO
-	my $skyDir = caturi($workdir, "tess_" . $tess_id, "sky_" . $skycell_id ); # Directory for output
-
+    foreach my $skycell_id ( @$skycells ) {
 	# Extract the skycell to an image
-	my $skyFile = $ipprc->file_prepare( $skycell_id, $skyDir );
+	my $skyFile = skycell_file($tess_id, $skycell_id, $workdir);
 	unless ($ipprc->file_exists( $skyFile )) {
 	    my $skyFileResolved = $ipprc->file_create( $skyFile ); # Resolved filename, for Nebulous
