Index: lib/TWiki/Attach.pm
===================================================================
RCS file: /e/www/CVS/twiki-cairo/lib/TWiki/Attach.pm,v
retrieving revision 1.1.1.2
retrieving revision 1.1.1.2.12.1
diff -r1.1.1.2 -r1.1.1.2.12.1
292c292
<     $meta->put( "FILEATTACHMENT", %fileAttachment );
---
>     $meta->putOne( "FILEATTACHMENT", %fileAttachment );
326c326
<     $meta->put( "FILEATTACHMENT", @attrs );
---
>     $meta->putOne( "FILEATTACHMENT", @attrs );
457c457
< 			$meta->put( "FILEATTACHMENT", @attrs );
---
> 			$meta->putOne( "FILEATTACHMENT", @attrs );
471c471
<                $meta->put( "FILEATTACHMENT", @values );
---
>                $meta->putOne( "FILEATTACHMENT", @values );
Index: lib/TWiki/Form.pm
===================================================================
RCS file: /e/www/CVS/twiki-cairo/lib/TWiki/Form.pm,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.12.1
diff -r1.1.1.1 -r1.1.1.1.12.1
535c535
<            $meta->put( "FIELD", @args );
---
>            $meta->putOne( "FIELD", @args );
771c771
<                 $meta->put( "FIELD", ( "name" => $name, "title" => $name, "value" => $value ) );
---
>                 $meta->putOne( "FIELD", ( "name" => $name, "title" => $name, "value" => $value ) );
795c795
<            $meta->put( "FIELD", @args );
---
>            $meta->putOne( "FIELD", @args );
Index: lib/TWiki/Meta.pm
===================================================================
RCS file: /e/www/CVS/twiki-cairo/lib/TWiki/Meta.pm,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.12.1
diff -r1.1.1.1 -r1.1.1.1.12.1
56,57c56
< # Replace data for this type.  If type is keyed then only the entry where
< # key matches relavent field is replaced
---
> # Replace data for this type. Type is not keyed.
72d70
<    my $key = _key( $type );
75,93d72
<        if( $key ) {
<            my $found = "";
<            my $keyName = $args{$key};
<            my @data = @$data;
<            unless( $keyName ) {
<                TWiki::writeWarning( "Meta: Required $key parameter is missing for META:$type" );
<                return;
<            }
<            for( my $i=0; $i<scalar @$data; $i++ ) {
<                if( $data[$i]->{$key} eq $keyName ) {
<                    $data->[$i] = \%args;
<                    $found = 1;
<                    last;
<                }
<            }
<            unless( $found ) {
<                push @$data, \%args;
<            }
<        } else {
95,96d73
<        }
< 
104c81,83
< # Give the key field for a type, "" if no key
---
> # Replace data for this type.  If type must be keyed by "name", and
> # only the entry where key matches relavent field is replaced.
> # Order that args sets are put in is maintained
107c86
< ---++ sub _key (  $type  )
---
> ---++ sub put (  $self, $type, %args  )
113c92
< sub _key
---
> sub putOne
115c94
<    my( $type ) = @_;
---
>    my( $self, $type, %args ) = @_;
117c96
<    my $key = "";
---
>    my $data = $self->{$type};
119,120c98,119
<    if( $type eq "FIELD" || $type eq "FILEATTACHMENT" ) {
<        $key = "name";
---
>    if( $data ) {
>            my $found = "";
>            my $keyName = $args{"name"};
>            my @data = @$data;
>            unless( $keyName ) {
>                TWiki::writeWarning( "Meta: Required name parameter is missing for META:$type" );
>                return;
>            }
>            for( my $i=0; $i<scalar @$data; $i++ ) {
>                if( $data[$i]->{"name"} eq $keyName ) {
>                    $data->[$i] = \%args;
>                    $found = 1;
>                    last;
>                }
>            }
>            unless( $found ) {
>                push @$data, \%args;
>            }
> 
>    } else {
>        my @data = ( \%args );
>        $self->{$type} = \@data;
126c125
< # Key needed for some types (see _key)
---
> # Key "name" used when $keyValue is passed
142d140
<    my $key = _key( $type );
145c143
<        if( $key ) {
---
>        if( defined $keyValue ) {
147c145
<                if( $item->{$key} eq $keyValue ) {
---
>                if( $item->{"name"} eq $keyValue ) {
188c186
< # with key, just remove specified item. Remove all types
---
> # with key "name", just remove specified item. Remove all types
203,204d200
<     my $key = "";
<     $key = _key( $type ) if( $type );
206c202
<     if( $keyValue && $key ) {
---
>     if( $keyValue ) {
210c206
<            if( $item->{$key} ne $keyValue ) {
---
>            if( $item->{"name"} ne $keyValue ) {
Index: lib/TWiki/Store.pm
===================================================================
RCS file: /e/www/CVS/twiki-cairo/lib/TWiki/Store.pm,v
retrieving revision 1.1.1.2
retrieving revision 1.1.1.2.12.1
diff -r1.1.1.2 -r1.1.1.2.12.1
209c209
<     $meta->put( "FILEATTACHMENT", %fileAttachment );    
---
>     $meta->putOne( "FILEATTACHMENT", %fileAttachment );    
