stas 2004/10/04 20:44:38 Modified: src/docs/2.0/api/APR Brigade.pod Bucket.pod BucketAlloc.pod src/docs/2.0/user/handlers protocols.pod Log: various fixes due to APR::Bucket API changes Revision Changes Path 1.12 +9 -8 modperl-docs/src/docs/2.0/api/APR/Brigade.pod Index: Brigade.pod =================================================================== RCS file: /home/cvs/modperl-docs/src/docs/2.0/api/APR/Brigade.pod,v retrieving revision 1.11 retrieving revision 1.12 diff -u -u -r1.11 -r1.12 --- Brigade.pod 4 Oct 2004 02:15:49 -0000 1.11 +++ Brigade.pod 5 Oct 2004 03:44:37 -0000 1.12 @@ -10,6 +10,7 @@ use APR::Brigade (); $bb = APR::Brigade->new($r->pool, $c->bucket_alloc); + $ba = $bb->bucket_alloc(); $pool = $bb->pool; $bb->insert_head($b); @@ -33,6 +34,7 @@ last if $bb->is_empty(); $bb->cleanup(); $bb->destroy(); + @@ -391,20 +393,18 @@ =head2 C<bucket_alloc> +Get the bucket allocator associated with this brigade. + my $ba = $bb->bucket_alloc(); - $bb2->bucket_alloc($ba); =over 4 =item obj: C<$bb> ( C<L<APR::Brigade object or class|docs::2.0::api::APR::Brigade>> ) - -=item opt arg1: C<$bucket_alloc> +=item ret: C<$ba> ( C<L<APR::BucketAlloc object|docs::2.0::api::APR::BucketAlloc>> ) -Get/set the bucket allocator associated with this brigade. - =item since: 1.99_17 =back @@ -550,9 +550,10 @@ brigade such that the second brigade will have the last two buckets. my $bb1 = APR::Brigade->new($r->pool, $c->bucket_alloc); - $bb1->insert_tail(APR::Bucket->new($c->bucket_alloc, "1")); - $bb1->insert_tail(APR::Bucket->new($c->bucket_alloc, "2")); - $bb1->insert_tail(APR::Bucket->new($c->bucket_alloc, "3")); + my $ba = $c->bucket_alloc(); + $bb1->insert_tail(APR::Bucket->new($ba, "1")); + $bb1->insert_tail(APR::Bucket->new($ba, "2")); + $bb1->insert_tail(APR::Bucket->new($ba, "3")); C<$bb1> now contains buckets "1", "2", "3". Now do the split at the second bucket: 1.15 +40 -26 modperl-docs/src/docs/2.0/api/APR/Bucket.pod Index: Bucket.pod =================================================================== RCS file: /home/cvs/modperl-docs/src/docs/2.0/api/APR/Bucket.pod,v retrieving revision 1.14 retrieving revision 1.15 diff -u -u -r1.14 -r1.15 --- Bucket.pod 4 Oct 2004 02:15:49 -0000 1.14 +++ Bucket.pod 5 Oct 2004 03:44:38 -0000 1.15 @@ -10,6 +10,9 @@ use APR::Bucket (); my $ba = $c->bucket_alloc; + $ba2 = APR::Bucket::alloc_create($pool); + APR::Bucket::alloc_destroy($ba2); + $b1 = APR::Bucket->new($ba, "aaa"); $b2 = APR::Bucket::eos_create($ba); $b3 = APR::Bucket::flush_create($ba); @@ -27,8 +30,9 @@ $b1->destroy; $b2->delete; # remove+destroy - - + + $b4 = APR::Bucket->new($ba, "to be setaside"); + $b4->setaside($pool); @@ -154,7 +158,7 @@ =head2 C<alloc_create> -Create an C<APR::BucketAlloc> freelist. +Create an C<APR::BucketAlloc> object: $ba = APR::Bucket::alloc_create($pool); @@ -163,27 +167,27 @@ =item arg1: C<$pool> ( C<L<APR::Pool object|docs::2.0::api::APR::Pool>> ) -The pool used to create this this freelist. +The pool used to create this object. =item ret: C<$ba> ( C<L<APR::BucketAlloc object|docs::2.0::api::APR::BucketAlloc>> ) -The new freelist. +The new object. =item since: 1.99_17 =back -These freelists are used to create new buckets and bucket -brigades. Normally it is not necesssary to create them, -since the existing bucket brigades and/or connection objects -in modperl-2 provide them automatically. +This bucket allocation list (freelist) is used to create new buckets +and bucket brigades. Normally it is not necesssary to create them, +since the existing bucket brigades and/or connection objects in +modperl 2.0 provide them automatically. Example: use APR::Bucket (); use Apache::Connection (); - my $ba = APR::Bucket::alloc_create($c->$pool); + my $ba = APR::Bucket::alloc_create($c->pool); my $eos_b = APR::Bucket::eos_create($ba); @@ -192,7 +196,8 @@ =head2 C<alloc_destroy> -Destroy an C<APR::BucketAlloc> freelist. +Destroy an C<L<APR::BucketAlloc +object|docs::2.0::api::APR::BucketAlloc>>: APR::Bucket::alloc_destroy($ba); @@ -203,14 +208,17 @@ The freelist to destroy. +=item ret: no return value + =item since: 1.99_17 =back -Destroys the freelist; this object may not be used again. -Normally it is not necessary to destroy allocators, since -the pool which created them will destroy them during pool -cleanup. +Once destroyed this object may not be used again. Normally it is not +necessary to destroy allocators, since the pool which created them +will destroy them during pool cleanup. + + @@ -415,17 +423,17 @@ Create a new bucket and initialize it with data: - $nb = APR::Bucket->new($bucket_alloc, $data); - $nb = $b->new($bucket_alloc, $data); - $nb = APR::Bucket->new($bucket_alloc, $data, $offset); - $nb = APR::Bucket->new($bucket_alloc, $data, $offset, $len); + $nb = APR::Bucket->new($ba, $data); + $nb = $b->new($ba, $data); + $nb = APR::Bucket->new($ba, $data, $offset); + $nb = APR::Bucket->new($ba, $data, $offset, $len); =over 4 =item obj: C<$b> ( C<L<APR::Bucket object or class|docs::2.0::api::APR::Bucket>> ) -=item arg1: C<$bucket_alloc> +=item arg1: C<$ba> ( C<L<APR::BucketAlloc object|docs::2.0::api::APR::BucketAlloc>> ) =item arg2: C<$data> ( string ) @@ -615,29 +623,35 @@ =head2 C<setaside> -Ensure the bucket's data lasts at least as long as the given pool. +Ensure the bucket's data lasts at least as long as the given pool: +XXX: change? - my $status = $bucket->setaside($pool); + my $status = $b->setaside($pool); =over 4 -=item obj: C<$bucket> +=item obj: C<$b> ( C<L<APR::Bucket object|docs::2.0::api::APR::Bucket>> ) =item arg1: C<$pool> ( C<L<APR::Pool object|docs::2.0::api::APR::Pool>> ) -=item ret: status code- APR_SUCCESS or error condition. +=item ret: + +XXX: it's going to change to no return value =item since: 1.99_17 =back -When the a modperl bucket is setaside, its data is detached from the +When a mod_perl bucket is setaside, its data is detached from the original perl scalar and copied into a pool bucket. Usually setaside -is called by certain output filters, in order to buffer socket writes +is called by certain output filters, in order to buffer socket writes of smaller buckets into a single write. + + + 1.4 +10 -8 modperl-docs/src/docs/2.0/api/APR/BucketAlloc.pod Index: BucketAlloc.pod =================================================================== RCS file: /home/cvs/modperl-docs/src/docs/2.0/api/APR/BucketAlloc.pod,v retrieving revision 1.3 retrieving revision 1.4 diff -u -u -r1.3 -r1.4 --- BucketAlloc.pod 18 Aug 2004 06:34:57 -0000 1.3 +++ BucketAlloc.pod 5 Oct 2004 03:44:38 -0000 1.4 @@ -1,6 +1,6 @@ =head1 NAME -APR::BucketAlloc - Perl API for apr_bucket_alloc_t +APR::BucketAlloc - Perl API for Bucket Allocation @@ -12,21 +12,23 @@ =head1 Description -C<APR::BucketAlloc> is for bucket allocation. +C<APR::BucketAlloc> is used for bucket allocation. At the moment C<APR::BucketAlloc> is a virtual class, which doesn't exists as a module/package - so you don't need to load it, nor does it contain any callable methods or functions. Objects blessed into C<APR::BucketAlloc> class, are returned by -C<L<$c-E<gt>bucket_alloc|docs::2.0::api::Apache::Connection/C_bucket_alloc_>> +C<L<$c-E<gt>bucket_alloc|docs::2.0::api::Apache::Connection/C_bucket_alloc_>>, +C<L<APR::Bucket::alloc_create|docs::2.0::api::APR::Bucket/C_alloc_create_>> +and +C<L<$bb-E<gt>bucket_alloc|docs::2.0::api::APR::Brigade/C_bucket_alloc_>>, and used by -C<L<APR::Brigade-E<gt>new|docs::2.0::api::APR::Brigade/C_new_>>. +C<L<APR::Brigade-E<gt>new|docs::2.0::api::APR::Brigade/C_new_>> and +C<L<APR::Bucket-E<gt>new|docs::2.0::api::APR::Bucket/C_new_>>. -At the moment it can be used only inside httpd. In order to be usable -outside httpd we may need to create a real package and provide an -alternative method to buckets allocation. It'll be added as soon as -there will be a need for that functionality. +C<L<APR::Bucket::alloc_create|docs::2.0::api::APR::Bucket/C_alloc_create_>> +can be used outside the httpd. 1.30 +1 -1 modperl-docs/src/docs/2.0/user/handlers/protocols.pod Index: protocols.pod =================================================================== RCS file: /home/cvs/modperl-docs/src/docs/2.0/user/handlers/protocols.pod,v retrieving revision 1.29 retrieving revision 1.30 diff -u -u -r1.29 -r1.30 --- protocols.pod 4 Oct 2004 02:15:49 -0000 1.29 +++ protocols.pod 5 Oct 2004 03:44:38 -0000 1.30 @@ -366,7 +366,7 @@ if ($b->read(my $data)) { $last++ if $data =~ /^[\r\n]+$/; # could do some transformation on data here - $b = APR::Bucket->new($bb->bucket_alloc, $data); + $b = APR::Bucket->new($bb_out->bucket_alloc, $data); } $b->remove;
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]