httpd-apreq-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject svn commit: r178974 - /httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/ /httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/Param.pod
Date Sun, 29 May 2005 18:23:20 GMT
Author: joes
Date: Sun May 29 11:23:19 2005
New Revision: 178974

Add EXISTS method and complete Param.pod docs.


Modified: httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/
--- httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/ (original)
+++ httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/ Sun May 29 11:23:19 2005
@@ -1,3 +1,4 @@
+package APR::Request::Param;
 use APR::Request;
 use APR::Table;
 use APR::Brigade;
@@ -36,3 +37,10 @@
 package APR::Request::Brigade::IO;
 push our(@ISA), ();
+package APR::Request::Param::Table;
+sub EXISTS {
+    my ($t, $key) = @_;
+    return defined $t->FETCH($key);

Modified: httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/Param.pod
--- httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/Param.pod (original)
+++ httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/Param.pod Sun May 29 11:23:19
@@ -291,17 +291,30 @@
 =head2 get
-    $table->get()
-    $table->get($name)
+    $table->get($key)
+Same as FETCH.
 =head2 FETCH
-    $table->FETCH($name)
+    $table->FETCH($key)
+In scalar context, this returns the first value matching
+$key (note: see NEXTKEY for additional notes).  The match 
+is always case-insensitive.  In list context, this returns
+all matching values.
-Same as get().
+=head EXISTS
+Synonym for C<< defined >>; these tables are not 
+allowed to contain undefined values. Since these
+are constant tables, they don't autovivify either.
@@ -310,6 +323,12 @@
+Returns the next key in the table.  For perl 5.8+,
+if the key is multivalued, a subsequent FETCH on 
+this key will return the corresponding value, until
+either NEXTKEY or FIRSTKEY is invoked again.  For
+perl 5.6, FETCH always returns the first value.
@@ -317,6 +336,8 @@
+Returns the first key in the table.
@@ -324,6 +345,14 @@
     $table->do($callback, @keys)
+Same as APR::Table::do; iterates over the table
+calling $callback->($key, $value) for each matching
+@keys.  If @keys is empty, this iterates over the 
+entire table.
+Note: The type of $value inserted into the callback
+depends on the table's current value_class.
@@ -331,21 +360,54 @@
+This class is derived from APR::Brigade, providing additional
+methods for TIEHANDLE, READ and READLINE.  To be memory efficient,
+these methods delete buckets from the brigade as soon as their
+data is actually read, so you cannot C<seek> on handles tied to
+this class.  Such handles have semantics similar to that of a
+read-only socket.
 =head2 new, TIEHANDLE
+    APR::Request::Brigade->TIEHANDLE($bb)
+Creates a copy of the bucket brigade represented by $bb, and
+blesses that copy into the APR::Request::Brigade class.  This
+provides syntactic sugar for using perl's builtin C<read>, C<readline>,
+and C<< <> >> operations on handles tied to this package:
+    use Symbol;
+    $fh = gensym;
+    tie *$fh, "APR::Request:Brigade", $bb;
+    print while <$fh>;
 =head2 READ
+    $bb->READ($contents)
+    $bb->READ($contents, $length)
+    $bb->READ($contents, $length, $offset)
+Reads data from the brigade $bb into $contents.  When omitted
+$length defaults to C<-1>, which reads the first bucket into $contents.
+A positive $length will read in $length bytes, or the remainder of the
+brigade, whichever is greater. $offset represents the index in $context
+to read the new data.
 =head2 READLINE
+    $bb->READLINE()
+Returns the first line of data from the bride. Lines are terminated by
+linefeeds (the '\012' character), but we may eventually use C<$/> instead.
@@ -358,17 +420,22 @@
 =head2 read
+OO interface to APR::Request::Brigade::READ.
 =head2 readline
+OO interface to APR::Request::Brigade::READLINE.
 =head1 SEE ALSO
+L<APR::Request>, L<APR::Table>, L<APR::Brigade>.

View raw message