Index: /trunk/PS-IPP-Metadata-Config/lib/PS/IPP/Metadata/Config.pm
===================================================================
--- /trunk/PS-IPP-Metadata-Config/lib/PS/IPP/Metadata/Config.pm	(revision 7829)
+++ /trunk/PS-IPP-Metadata-Config/lib/PS/IPP/Metadata/Config.pm	(revision 7830)
@@ -1,5 +1,5 @@
 # Copyright (c) 2005  Joshua Hoblitt
 #
-# $Id: Config.pm,v 1.16 2005-05-04 22:09:28 jhoblitt Exp $
+# $Id: Config.pm,v 1.17 2006-07-06 21:49:27 jhoblitt Exp $
 
 package PS::IPP::Metadata::Config;
@@ -208,4 +208,11 @@
             } else {
                 $return = undef;
+            }
+
+            if ( defined $thisparser->{local}{name}{ $item{metadata_name} } ) {
+                $return->{multi}++
+                    if $thisparser->{local}{name}{ $item{metadata_name} } =~ /MULTI/;
+            } else {
+                $thisparser->{local}{name}{ $item{metadata_name} }++;
             }
         } 
Index: /trunk/PS-IPP-Metadata-Config/t/06_multi.t
===================================================================
--- /trunk/PS-IPP-Metadata-Config/t/06_multi.t	(revision 7829)
+++ /trunk/PS-IPP-Metadata-Config/t/06_multi.t	(revision 7830)
@@ -3,5 +3,5 @@
 # Copyright (C) 2005  Joshua Hoblitt
 #
-# $Id: 06_multi.t,v 1.5 2005-03-24 22:32:55 jhoblitt Exp $
+# $Id: 06_multi.t,v 1.6 2006-07-06 21:49:28 jhoblitt Exp $
 
 use strict;
@@ -15,6 +15,4 @@
 use PS::IPP::Metadata::Config;
 
-my $config_parser = PS::IPP::Metadata::Config->new;
-
 {
 my $example = q{
@@ -24,5 +22,5 @@
 foo BOOL    T
 };
-    my $config = $config_parser->parse( $example );
+    my $config = PS::IPP::Metadata::Config->new->parse( $example );
     ok( defined( $config ), "basic MULTI");
 }
@@ -35,5 +33,5 @@
 foo BOOL    T           #
 };
-    my $config = $config_parser->parse( $example );
+    my $config = PS::IPP::Metadata::Config->new->parse( $example );
     ok( defined( $config ), "MULTI with comments");
 }
@@ -52,5 +50,5 @@
 END
 };
-    my $config = $config_parser->parse( $example );
+    my $config = PS::IPP::Metadata::Config->new->parse( $example );
     ok( defined( $config ), "MULTI not visible in lower scopes");
 }
@@ -66,18 +64,5 @@
 END
 };
-    my $config = $config_parser->parse( $example );
-    ok( defined( $config ), "MULTI METADATA");
-}
-
-{
-my $example = q{
-foo METADATA
-    bar BOOL    T
-END
-foo METADATA
-    bar BOOL    T
-END
-};
-    my $config = $config_parser->parse( $example );
+    my $config = PS::IPP::Metadata::Config->new->parse( $example );
 
     my $tree = [
@@ -92,6 +77,43 @@
                         }],
         },
+        {
+            name    => 'foo',
+            class   => 'metadata',
+            value   => [{
+                            name    => 'bar',
+                            class   => 'scalar',
+                            type    => 'BOOL',
+                            value   => 1,
+                        }],
+        },
     ];
 
+    is_deeply( $config, $tree, "MULTI METADATA structure, declared" );
+}
+
+{
+my $example = q{
+foo METADATA
+    bar BOOL    T
+END
+foo METADATA
+    bar BOOL    T
+END
+};
+    my $config = PS::IPP::Metadata::Config->new->parse( $example );
+
+    my $tree = [
+        {
+            name    => 'foo',
+            class   => 'metadata',
+            value   => [{
+                            name    => 'bar',
+                            class   => 'scalar',
+                            type    => 'BOOL',
+                            value   => 1,
+                        }],
+        },
+    ];
+
     is_deeply( $config, $tree, "MULTI METADATA structure, not declared" );
 }
@@ -104,5 +126,5 @@
 foo  bar x y z
 };
-    my $config = $config_parser->parse( $example );
+    my $config = PS::IPP::Metadata::Config->new->parse( $example );
     ok( defined( $config ), "MULTI TYPE");
 }
@@ -115,5 +137,5 @@
 foo  bar x y z
 };
-    my $config = $config_parser->parse( $example );
+    my $config = PS::IPP::Metadata::Config->new->parse( $example );
 
     ok( defined( $config ), "MULTI TYPE");
@@ -126,5 +148,5 @@
 foo  bar x y z
 };
-    my $config = $config_parser->parse( $example );
+    my $config = PS::IPP::Metadata::Config->new->parse( $example );
 
     my $tree = [
@@ -166,5 +188,5 @@
 END
 };
-    my $config = $config_parser->parse( $example );
+    my $config = PS::IPP::Metadata::Config->new->parse( $example );
     # ok because of overwrite
     ok( defined( $config ), "MULTI not in scope");
@@ -179,5 +201,5 @@
 foo STR     bar baz
 };
-    my $config = $config_parser->parse( $example );
+    my $config = PS::IPP::Metadata::Config->new->parse( $example );
     # ok because of overwrite
     ok( defined( $config ), "MULTI not in scope");
@@ -193,5 +215,5 @@
 END
 };
-    my $config = $config_parser->parse( $example );
+    my $config = PS::IPP::Metadata::Config->new->parse( $example );
     # ok because of overwrite
     ok( defined( $config ), "MULTI not in scope");
@@ -204,5 +226,5 @@
 foo S8      -1
 };
-    my $config = $config_parser->parse( $example );
+    my $config = PS::IPP::Metadata::Config->new->parse( $example );
     ok( !defined( $config ), "MULTI redeclaration");
 }
@@ -213,5 +235,5 @@
 foo STR     bar baz
 };
-    my $config = $config_parser->parse( $example );
+    my $config = PS::IPP::Metadata::Config->new->parse( $example );
     # ok because of overwrite
     ok( defined( $config ), "missing MULTI declaration");
