stas 2004/07/14 23:24:12 Modified: src/docs/2.0/api/APR Table.pod Log: fix an old outstanding bug in the APR::Table's TIE interface with each()/values() over tables with multi-values keys. Now the produced order is correct and consistent with keys(). Though, values() works correctly only with perl 5.8.x and higher. Revision Changes Path 1.10 +34 -6 modperl-docs/src/docs/2.0/api/APR/Table.pod Index: Table.pod =================================================================== RCS file: /home/cvs/modperl-docs/src/docs/2.0/api/APR/Table.pod,v retrieving revision 1.9 retrieving revision 1.10 diff -u -u -r1.9 -r1.10 --- Table.pod 22 May 2004 02:03:26 -0000 1.9 +++ Table.pod 15 Jul 2004 06:24:12 -0000 1.10 @@ -845,12 +845,19 @@ C<DELETE>, C<CLEAR>, C<EXISTS>, C<FIRSTKEY>, C<NEXTKEY> and C<DESTROY>. -remark: C<APR::Table> can hold more than one key-value pair sharing -the same key, so when using a table through the tied interface, the -first entry found with the right key will be used, completely -disregarding possible other entries with the same key. The only -exception to this is if you iterate over the list with C<each()>, then -you can access all key-value pairs that share the same key. +Note regarding the use of C<values()>. C<APR::Table> can hold more +than one key-value pair sharing the same key, so when using a table +through the tied interface, the first entry found with the right key +will be used, completely disregarding possible other entries with the +same key. With Perl 5.8.0 and higher C<values()> will correctly list +values the corresponding to the list generated by C<keys()>. That +doesn't work with Perl 5.6. Therefore to portably iterate over the +key-value pairs, use C<each()> (which fully supports multivalued +keys), or C<APR::Table::do>. + + + + =head2 C<EXISTS> @@ -954,6 +961,27 @@ =item since: 1.99_10 =back + +When iterating through the table's entries with C<each()>, C<FETCH> +will return the current value of a multivalued key. For example: + + $table->add("a" => 1); + $table->add("b" => 2); + $table->add("c" => 3); + + ($k, $v) = each %$table; # (a, 1) + print $table->{a}; # prints 1 + + ($k, $v) = each %$table; # (b, 2) + print $table->{a}; # prints 1 + + ($k, $v) = each %$table; # (a, 3) + print $table->{a}; # prints 3 !!! + + ($k, $v) = each %$table; # (undef, undef) + print $table->{a}; # prints 1 + +
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]