You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by "Philippe M. Chiasson" <go...@cpan.org> on 2001/10/22 11:55:13 UTC

[Patch] Document APR::Table TIE interface

/home/gozer/sources/mod_perl2/deps/perl/bin/perl build/cvsdiff 
Index: docs/src/api/mod_perl-2.0/APR/Table.pod
===================================================================
RCS file: /home/anoncvs/mod_perl-docs-cvs/src/api/mod_perl-2.0/APR/Table.pod,v
retrieving revision 1.1
diff -u -I'$Id' -I'$Revision' -r1.1 Table.pod
--- docs/src/api/mod_perl-2.0/APR/Table.pod	2001/10/02 14:59:17	1.1
+++ docs/src/api/mod_perl-2.0/APR/Table.pod	2001/10/22 09:54:39
@@ -21,6 +21,15 @@
   $table->merge($key => $val);
   overlap($table_a, $table_b, $flags);
   $new_table = overlay($table_base, $table_overlay, $pool);
+  
+  #Tied Interface
+  $table->{$key} = $value;
+  delete $table->{$key};
+  exists $table->{$key};
+  
+  foreach my $key (keys %{$table}) {
+    print "$key = $table->{$key}\n";
+    }
 
 =head1 DESCRIPTION
 
@@ -225,11 +234,16 @@
 
 =head2 TIE Interface
 
-APR::Table sports TIE interface, so you can work with the C<$table>
-object as a hash.
+APR::Table also implements a tied interface, so you can work with the C<$table>
+object as a hashref.
 
-META: complete
+All Tied hash function are supported, FETCH, STORE, DELETE, CLEAR, EXISTS,
+FIRSTKEY, NEXTKEY & DESTROY.
 
+remark: APR::Tables can hold more than one key-value pair sharing the same key,
+so when using a table thru the tied interface, the first entry found with the
+right key will be used, completely disreagarding possible other entries with the
+same key.  The only exception to this is if you iterate over the list with 'each'. 
 
 =cut
 


-- 
Philippe M. Chiasson  <go...@cpan.org>
  Extropia's Resident System Guru
     http://www.eXtropia.com/

Go away...I'm alright. (last words)
	-- H. G. Wells

perl -e '$$=\${gozer};{$_=unpack(P26,pack(L,$$));/^Just Another Perl Hacker!\n$/&&print||$$++&&redo}'

Re: [Patch] Document APR::Table TIE interface

Posted by "Philippe M. Chiasson" <go...@cpan.org>.
On Mon, Oct 22, 2001 at 11:55:51PM +0800, Stas Bekman wrote:
> Philippe M. Chiasson wrote:
> 
> > /home/gozer/sources/mod_perl2/deps/perl/bin/perl build/cvsdiff 
> > Index: docs/src/api/mod_perl-2.0/APR/Table.pod
> 
> 
> committed, thanks!
> 
> 
> > +remark: APR::Tables can hold more than one key-value pair sharing the same key,
> > +so when using a table thru the tied interface, the first entry found with the
> > +right key will be used, completely disreagarding possible other entries with the
> > +same key.  The only exception to this is if you iterate over the list with 'each'. 
> 
> and then...? you get all the values for the same key?

Yes, right now, the regular hash accessors will simply pick the first entry in
the table that matches the key you are interested in.  The only way to access
more than one key-value pair that share the same key is by using 

each %$table

> 
> _____________________________________________________________________
> Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
> http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
> mailto:stas@stason.org  http://ticketmaster.com http://apacheweek.com
> http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
> 

-- 
Philippe M. Chiasson  <go...@cpan.org>
  Extropia's Resident System Guru
     http://www.eXtropia.com/

New versions happen. 
	-- Larry Wall

perl -e '$$=\${gozer};{$_=unpack(P26,pack(L,$$));/^Just Another Perl Hacker!\n$/&&print||$$++&&redo}'

Re: [Patch] Document APR::Table TIE interface

Posted by Stas Bekman <st...@stason.org>.
Philippe M. Chiasson wrote:

> /home/gozer/sources/mod_perl2/deps/perl/bin/perl build/cvsdiff 
> Index: docs/src/api/mod_perl-2.0/APR/Table.pod


committed, thanks!


> +remark: APR::Tables can hold more than one key-value pair sharing the same key,
> +so when using a table thru the tied interface, the first entry found with the
> +right key will be used, completely disreagarding possible other entries with the
> +same key.  The only exception to this is if you iterate over the list with 'each'. 

and then...? you get all the values for the same key?

_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:stas@stason.org  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org