Author: randyk Date: Sat Apr 2 21:06:25 2005 New Revision: 159887 URL: http://svn.apache.org/viewcvs?view=rev&rev=159887 Log: s/Apache/Apache2/
Modified: perl/modperl/docs/trunk/src/docs/2.0/api/Apache2/compat.pod Modified: perl/modperl/docs/trunk/src/docs/2.0/api/Apache2/compat.pod URL: http://svn.apache.org/viewcvs/perl/modperl/docs/trunk/src/docs/2.0/api/Apache2/compat.pod?view=diff&r1=159886&r2=159887 ============================================================================== --- perl/modperl/docs/trunk/src/docs/2.0/api/Apache2/compat.pod (original) +++ perl/modperl/docs/trunk/src/docs/2.0/api/Apache2/compat.pod Sat Apr 2 21:06:25 2005 @@ -1,6 +1,6 @@ =head1 NAME -Apache::compat -- 1.0 backward compatibility functions deprecated in 2.0 +Apache2::compat -- 1.0 backward compatibility functions deprecated in 2.0 @@ -9,16 +9,14 @@ =head1 Synopsis # either add at the very beginning of startup.pl - use Apache2 - use Apache::compat; + use Apache2::compat; # or httpd.conf - PerlModule Apache2 - PerlModule Apache::compat + PerlModule Apache2::compat # override and restore compat functions colliding with mp2 API - Apache::compat::override_mp2_api('Apache::Connection::local_addr'); + Apache2::compat::override_mp2_api('Apache2::Connection::local_addr'); my ($local_port, $local_addr) = sockaddr_in($c->local_addr); - Apache::compat::restore_mp2_api('Apache::Connection::local_addr'); + Apache2::compat::restore_mp2_api('Apache2::Connection::local_addr'); @@ -27,7 +25,7 @@ =head1 Description -C<Apache::compat> provides mod_perl 1.0 compatibility layer and can be +C<Apache2::compat> provides mod_perl 1.0 compatibility layer and can be used to smooth the transition process to mod_perl 2.0. It includes functions that have changed their API or were removed in @@ -51,7 +49,7 @@ =head1 Compatibility Functions Colliding with mod_perl 2.0 API -Most of the functions provided by Apache::compat don't interfere with +Most of the functions provided by Apache2::compat don't interfere with mod_perl 2.0 API. However there are several functions which have the same name in the mod_perl 1.0 and mod_perl 2.0 API, accept the same number of arguments, but either the arguments themselves aren't the @@ -64,7 +62,7 @@ should be adjusted to be: - require Apache::Connection; + require Apache2::Connection; require APR::SockAddr; my $sockaddr = $c->local_addr; my ($local_port, $local_addr) = ($sockaddr->port, $sockaddr->ip_get); @@ -74,7 +72,7 @@ As you can see in mod_perl 1.0 API local_addr() was returning a SOCKADDR_IN object (see the Socket perl manpage), in mod_perl 2.0 API it returns an C<L<APR::SockAddr|docs::2.0::api::APR::SockAddr>> -object, which is a totally different beast. If Apache::compat +object, which is a totally different beast. If Apache2::compat overrides the function C<local_addr()> to be back-compatible with mod_perl 1.0 API. Any code that relies on this function to work as it should under mod_perl 2.0 will be broken. Therefore the solution is @@ -92,9 +90,9 @@ you could do the following: - Apache::compat::override_mp2_api('Apache::Connection::local_addr'); + Apache2::compat::override_mp2_api('Apache2::Connection::local_addr'); my ($local_port, $local_addr) = Socket::sockaddr_in($c->local_addr); - Apache::compat::restore_mp2_api('Apache::Connection::local_addr'); + Apache2::compat::restore_mp2_api('Apache2::Connection::local_addr'); Notice that you need to restore the API as soon as possible. @@ -113,17 +111,17 @@ =over -=item * C<Apache::RequestRec::notes> +=item * C<Apache2::RequestRec::notes> -=item * C<Apache::RequestRec::filename> +=item * C<Apache2::RequestRec::filename> -=item * C<Apache::RequestRec::finfo> +=item * C<Apache2::RequestRec::finfo> -=item * C<Apache::Connection::local_addr> +=item * C<Apache2::Connection::local_addr> -=item * C<Apache::Connection::remote_addr> +=item * C<Apache2::Connection::remote_addr> -=item * C<Apache::Util::ht_time> +=item * C<Apache2::Util::ht_time> =item * C<APR::URI::unparse> @@ -140,18 +138,18 @@ =head1 Use in CPAN Modules -The short answer: B<Do not use> C<Apache::compat> in CPAN modules. +The short answer: B<Do not use> C<Apache2::compat> in CPAN modules. The long answer: -C<Apache::compat> is useful during the mod_perl 1.0 code +C<Apache2::compat> is useful during the mod_perl 1.0 code porting. Though remember that it's implemented in pure Perl. In certain cases it overrides mod_perl 2.0 methods, because their API is very different and doesn't map 1:1 to mod_perl 1.0. So if anything, -not under user's control, loads C<Apache::compat> user's code is +not under user's control, loads C<Apache2::compat> user's code is forced to use the potentially slower method. Which is quite bad. -Some users may choose to keep using C<Apache::compat> in production +Some users may choose to keep using C<Apache2::compat> in production and it may perform just fine. Other users will choose not to use that module, by porting their code to use mod_perl 2.0 API. However it should be users' choice whether to load this module or not and not to @@ -161,10 +159,10 @@ follow the porting L<Perl|docs::2.0::user::porting::porting> and L<XS|docs::2.0::devel::porting::porting> module guidelines. -Users that are stuck with CPAN modules preloading C<Apache::compat>, +Users that are stuck with CPAN modules preloading C<Apache2::compat>, can prevent this from happening by adding - $INC{'Apache/compat.pm'} = __FILE__; + $INC{'Apache2/compat.pm'} = __FILE__; at the very beginning of their I<startup.pl>. But this will most certainly break the module that needed this module. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]