You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-cvs@httpd.apache.org by jo...@apache.org on 2005/05/29 20:23:20 UTC

svn commit: r178974 - /httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/Param.pm /httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/Param.pod

Author: joes
Date: Sun May 29 11:23:19 2005
New Revision: 178974

URL: http://svn.apache.org/viewcvs?rev=178974&view=rev
Log:
Add EXISTS method and complete Param.pod docs.

Modified:
    httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/Param.pm
    httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/Param.pod

Modified: httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/Param.pm
URL: http://svn.apache.org/viewcvs/httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/Param.pm?rev=178974&r1=178973&r2=178974&view=diff
==============================================================================
--- httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/Param.pm (original)
+++ httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/Param.pm 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
URL: http://svn.apache.org/viewcvs/httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/Param.pod?rev=178974&r1=178973&r2=178974&view=diff
==============================================================================
--- 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 2005
@@ -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 @@
 
     $table->NEXTKEY()
 
+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 @@
 
     $table->FIRSTKEY()
 
+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 @@
 
 APR::Request::Brigade
 
+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::Request>, L<APR::Table>, L<APR::Brigade>.