Return-Path: Delivered-To: apmail-perl-docs-cvs-archive@perl.apache.org Received: (qmail 43959 invoked by uid 500); 5 Jun 2002 10:25:08 -0000 Mailing-List: contact docs-cvs-help@perl.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Delivered-To: mailing list docs-cvs@perl.apache.org Received: (qmail 43948 invoked by uid 500); 5 Jun 2002 10:25:07 -0000 Delivered-To: apmail-modperl-docs-cvs@apache.org Date: 5 Jun 2002 10:25:06 -0000 Message-ID: <20020605102506.5258.qmail@icarus.apache.org> From: stas@apache.org To: modperl-docs-cvs@apache.org Subject: cvs commit: modperl-docs/src/docs/2.0/user/compat compat.pod X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N stas 2002/06/05 03:25:06 Modified: src/docs/2.0/user/compat compat.pod Log: - documenting log functions changes and a few other recent compat changes - polishing the doc Revision Changes Path 1.23 +168 -76 modperl-docs/src/docs/2.0/user/compat/compat.pod Index: compat.pod =================================================================== RCS file: /home/cvs/modperl-docs/src/docs/2.0/user/compat/compat.pod,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- compat.pod 4 Jun 2002 10:16:44 -0000 1.22 +++ compat.pod 5 Jun 2002 10:25:06 -0000 1.23 @@ -163,7 +163,7 @@ =back See the manpages of the respective modules to figure out which -constants they provide. (XXX: the manpages don't exist) +constants they provide. (XXX: not all manpages exist yet.) META: add the info how to perform the transition. XXX: may be write a script, which can tell you how to port the constants to 2.0? Currently @@ -175,13 +175,34 @@ -=head1 C +=head1 C Methods +=head2 Crequest> +Crequest> is deprecated. It's error-prone and hurts +performance when using threaded MPMs, since it has to use thread local +storage. -=head2 Cdefine()> +For any location that uses Crequest> and uses +C<"modperl"> handler, you need to configure: + + + SetHandler modperl + PerlOptions +GlobalRequest + ... + + +It's already enabled for: -Cdefine()> has been replaced with + + SetHandler perl-script + ... + + + +=head2 Cdefine> + +Cdefine> has been replaced with C residing inside C. @@ -195,22 +216,52 @@ See the C> manpage. -=head2 C +=head2 C Since Perl 5.6.1 filehandlers are autovivified and there is no need for C function, since now it can be done with: open my $fh, "foo" or die $!; -Though the C function modperl_perl_gensym() is available for XS/C +Though the C function C is available for XS/C extensions writers. -=head2 C +=head2 C -C has been replaced with the function +C has been replaced with the function C, which now accepts a single argument: the module name. +=head2 C + +C is not available in mod_perl 2.0 API. You can +use: + + Apache->server->log_error + +instead. See the C> manpage. + + + + + +=head1 Server Object Methods + +=head2 C<$s-Eregister_cleanup> + +C<$s-Eregister_cleanup> has been replaced with +C which accepts the pool object as the +first argument instead of the server object. e.g.: + + sub cleanup_callback { my $data = shift; ... } + $s->pool->cleanup_register(\&cleanup_callback, $data); + +where the last argument C<$data> is optional, and if supplied will be +passed as the first argument to the callback function. + +See the C> manpage. + + @@ -218,22 +269,30 @@ =head1 Request Object Methods -=head2 C<$r-Elookup_file>, C<$r-Elookup_uri>, +=head2 C<$r-Elookup_file> + +See the next item + +=head2 C<$r-Elookup_uri> + +C<$r-Elookup_file> and C<$r-Elookup_uri> didn't change their +functionality but moved into C>. Before using +them, add: + + use Apache::SubRequest; -These functions have moved but didn't change their functionality. In -order to use them load the module they belong to in mod_perl 2.0: - $r->lookup_file Apache::SubRequest - $r->lookup_uri Apache::SubRequest +=head2 C<$r-Econtent> +See the next item. -=head2 C<$r-Econtent()> and C<$r-Eargs()> in an Array Context +=head2 C<$r-Eargs> in an Array Context -C<$r-Eargs()> in 2.0 returns the query string without parsing and +C<$r-Eargs> in 2.0 returns the query string without parsing and splitting it into an array. You can also set the query string by passing a string to this method. -C<$r-Econtent()> and C<$r-Eargs()> in an array context were +C<$r-Econtent> and C<$r-Eargs> in an array context were mistakes that never should have been part of the mod_perl 1.0 API. There multiple reason for that, among others: @@ -270,30 +329,31 @@ =back -Instead you should use C's params() and similar -methods to do the parsing for you. See the L manpage. +Instead you should use C's C and similar +methods to do the parsing for you. See the C> +manpage. XXX: ...when Apache::Request will be ported to 2.0. For now you can use the code in C that implements these methods in Perl. -=head2 C +=head2 C<$r-Echdir_file> -C is not a thread-safe function, therefore C is -gone from the API. +C is not a thread-safe function, therefore +C<$r-Echdir_file> is gone from the API. =head2 C<$r-Econnection-Euser> -This method is deprecated in 1.0 and C<$r-Euser> should be used -instead for both versions of mod_perl. C method is -available since mod_perl version 1.24_01. +This method is deprecated in mod_perl 1.0 and C<$r-Euser> should +be used instead, for both versions of mod_perl. C<$r-Euser()> +method is available since mod_perl version 1.24_01. -=head2 C<$r-Eis_main()> +=head2 C<$r-Eis_main> -C<$r-Eis_main()> is not part of the mod_perl 2.0 API. Use -Cmain()> instead. +C<$r-Eis_main> is not part of the mod_perl 2.0 API. Use +Cmain> instead. -=head2 C<$r-Efinfo()> +=head2 C<$r-Efinfo> XXX: not implemented yet. To be implemented. C handles that for now with: @@ -304,7 +364,15 @@ \*_; } -=head2 C<$r-Eheader_in()>, C<$r-Eheader_out()> and C<$r-Eerr_header_out()> +=head2 C<$r-Eheader_in> + +See the next item. + +=head2 C<$r-Eheader_out> + +See the next item. + +=head2 C<$r-Eerr_header_out> C, C and C are not available in 2.0. Use C, C and @@ -320,56 +388,42 @@ See the L manpage. +=head2 C<$r-Elog_reason> +C<$r-Elog_reason> is not available in mod_perl 2.0 API. Use the +other standard logging functions provided by the C> +module. For example: -=head2 C<$r-Elog_reason()> - -C has been replaced with a set of dedicated functions: -C, C, -C and others. + $r->log_error("it works!"); -See the L, L and L -manpages. +See the C> manpage. -=head2 C<$r-Eregister_cleanup()> +=head2 C<$r-Eregister_cleanup> -register_cleanup() has been replaced with +C<$r-Eregister_cleanup> has been replaced with C which accepts the pool object as the first argument instead of the request object. e.g.: - $r->pool->cleanup_register(\&cleanup, $data); + sub cleanup_callback { my $data = shift; ... } + $r->pool->cleanup_register(\&cleanup_callback, $data); -where the last argument C<$data> is optional. +where the last argument C<$data> is optional, and if supplied will be +passed as the first argument to the callback function. See the L manpage. -=head2 C<$r-Erequest()> +=head2 C<$r-Erequest> -Use C. +Use Crequest>. -Notice that Crequest> is deprecated. It's error-prone -and hurts performance when using threaded MPMs, since it has to use -thread local storage. -For any location that uses Crequest> and uses -C<"modperl"> handler, you need to configure: +=head2 C<$r-Esend_fd> - - SetHandler modperl - PerlOptions +GlobalRequest - ... - - -It's already enabled for: - - - SetHandler perl-script - ... - +See the next item. -=head2 C<$r-Esend_fd()> and C<$r-Esend_fd_length()> +=head2 C<$r-Esend_fd_length> currently available only in the 1.0 compatibility layer. The problem is that Apache has changed the API and the its functionality. See the @@ -385,10 +439,22 @@ See the L manpage. -=head2 C<$r-Ehard_timeout()>, C<$r-Ereset_timeout()>, C<$r-Esoft_timeout()> and C<$r-Ekill_timeout()> +=head2 C<$r-Ehard_timeout> -The functions C<$r-Ehard_timeout()>, C<$r-Ereset_timeout()>, -C<$r-Esoft_timeout()> and C<$r-Ekill_timeout()> aren't needed +See the next item. + +=head2 C<$r-Ereset_timeout> + +See the next item. + +=head2 C<$r-Esoft_timeout> + +See the next item. + +=head2 C<$r-Ekill_timeout> + +The functions C<$r-Ehard_timeout>, C<$r-Ereset_timeout>, +C<$r-Esoft_timeout> and C<$r-Ekill_timeout> aren't needed in mod_perl 2.0. @@ -397,8 +463,8 @@ =head1 Apache::File -The methods from module C have been either moved to -other packages or removed. +The methods from mod_perl 1.0's module C have been +either moved to other packages or removed. =head2 C and C @@ -417,9 +483,29 @@ mtime() now belongs to the module L. -=head2 C, C, C, C, C and C +=head2 C + +This function now belongs to the module C>. + +=head2 C + +This function now belongs to the module C>. -These functions now belong to the module L. +=head2 C + +This function now belongs to the module C>. + +=head2 C + +This function now belongs to the module C>. + +=head2 C + +This function now belongs to the module C>. + +=head2 C + +This function now belongs to the module C>. @@ -430,11 +516,11 @@ A few C functions have changed their interface. -=head2 C +=head2 C -C has been replaced with -C, which returns formatted strings of only 4 -characters long. See the C> manpage. +C has been replaced with +C, which returns formatted strings of only +4 characters long. See the C> manpage. =head2 C @@ -480,11 +566,17 @@ See the I manpage. -mod_perl 2.0 doesn't support the C<($$)> prototypes, mainly because -several callbacks in 2.0 have more arguments than C<$r>, so the -C<($$)> prototype doesn't make sense anymore. Therefore if you want -your code to work with both mod_perl generations, you should use the -subroutine attributes. +mod_perl 2.0 doesn't handles callbacks with C<($$)> prototypes +differently than other callbacks (as it did in mod_perl 1.0), mainly +because several callbacks in 2.0 have more arguments than just C<$r>, +so the C<($$)> prototype doesn't make sense anymore. Therefore if you +want your code to work with both mod_perl generations and you can +allow the luxury of: + + require 5.6.0; + +you should use the subroutine attributes. The subroutine attributes +are supported in Perl only since version 5.6.0. --------------------------------------------------------------------- To unsubscribe, e-mail: docs-cvs-unsubscribe@perl.apache.org For additional commands, e-mail: docs-cvs-help@perl.apache.org