Index: /trunk/DataStore/lib/DataStore/File/Parser.pm
===================================================================
--- /trunk/DataStore/lib/DataStore/File/Parser.pm	(revision 6615)
+++ /trunk/DataStore/lib/DataStore/File/Parser.pm	(revision 6616)
@@ -1,5 +1,5 @@
 # Copyright (C) 2006  Joshua Hoblitt
 #
-# $Id: Parser.pm,v 1.9 2006-03-16 22:00:29 jhoblitt Exp $
+# $Id: Parser.pm,v 1.10 2006-03-17 01:18:48 jhoblitt Exp $
 
 package DataStore::File::Parser;
@@ -15,11 +15,7 @@
 use Carp qw( carp );
 use Data::Validate::URI qw( is_uri ); 
+use DataStore::Utils qw( $STD_FIELD $BYTE_FIELD $MD5_FIELD %KNOWN_FILE_TYPES );
 use DataStore::File;
 use Params::Validate qw( validate validate_pos SCALAR );
-
-my $std_field = qr/^[a-z0-9-_.]+$/;
-my $byte_field = qr/^\d+$/;
-my $md5_field = qr/^[0-9a-f]{32}$/;
-my %known_types = map { $_ => 1 } qw( chip );
 
 __PACKAGE__->mk_ro_accessors(qw(base_uri));
@@ -163,7 +159,7 @@
         # validate format of fileid and type
         foreach my $field ($fileid, $type) {
-            unless ($field =~ $std_field) {
+            unless ($field =~ $STD_FIELD) {
                 carp "line $lineno: field $field:"
-                   . " does not conform to $std_field: $line";
+                   . " does not conform to $STD_FIELD: $line";
                 next LINE;
             }
@@ -171,14 +167,19 @@
 
         # validate format of bytes
-        unless ($bytes =~ $byte_field) {
+        unless ($bytes =~ $BYTE_FIELD) {
             carp "line $lineno: field $bytes:"
-               . " does not conform to $byte_field: $line";
+               . " does not conform to $BYTE_FIELD: $line";
             next LINE;
         }
 
         # validate format of md5sum, hex encoded
-        unless ($md5sum =~ $md5_field) {
+        unless ($md5sum =~ $MD5_FIELD) {
             carp "line $lineno: field $md5sum:"
-               . " does not conform to $md5_field: $line";
+               . " does not conform to $MD5_FIELD: $line";
+            next LINE;
+        }
+
+        unless (exists $KNOWN_FILE_TYPES{$type}) {
+            carp "line $lineno: type $type unknown: $line";
             next LINE;
         }
Index: /trunk/DataStore/lib/DataStore/FileSet/Parser.pm
===================================================================
--- /trunk/DataStore/lib/DataStore/FileSet/Parser.pm	(revision 6615)
+++ /trunk/DataStore/lib/DataStore/FileSet/Parser.pm	(revision 6616)
@@ -1,5 +1,5 @@
 # Copyright (C) 2006  Joshua Hoblitt
 #
-# $Id: Parser.pm,v 1.11 2006-03-16 22:00:29 jhoblitt Exp $
+# $Id: Parser.pm,v 1.12 2006-03-17 01:18:48 jhoblitt Exp $
 
 package DataStore::FileSet::Parser;
@@ -16,9 +16,6 @@
 use Data::Validate::URI qw( is_uri );
 use DataStore::FileSet;
+use DataStore::Utils qw( $STD_FIELD $TIME_FIELD %KNOWN_FILESET_TYPES );
 use Params::Validate qw( validate validate_pos SCALAR);
-
-my $time_field = qr/^ (\d{4})-(\d\d)-(\d\d) T (\d\d):(\d\d):(\d\d) Z $/x;
-my $std_field = qr/^[a-z0-9-_.]+$/;
-my %known_types = map { $_ => 1 } qw( object domeflat skyflat bias dark );
 
 __PACKAGE__->mk_ro_accessors(qw(base_uri));
@@ -161,7 +158,7 @@
         # validate format of fileset and type
         foreach my $field ($fileset, $type) {
-            unless ($field =~ $std_field) {
+            unless ($field =~ $STD_FIELD) {
                 carp "line $lineno: field $field:"
-                   . " does not conform to $std_field: $line";
+                   . " does not conform to $STD_FIELD: $line";
                 next LINE;
             }
@@ -169,11 +166,11 @@
 
         # validate format of datetime
-        unless ($datetime =~ $time_field) {
+        unless ($datetime =~ $TIME_FIELD) {
             carp "line $lineno: field $datetime:"
-               . " does not conform to $time_field";
+               . " does not conform to $TIME_FIELD";
             next LINE;
         }
 
-        unless (exists $known_types{$type}) {
+        unless (exists $KNOWN_FILESET_TYPES{$type}) {
             carp "line $lineno: type $type unknown: $line";
             next LINE;
