Return-Path: Delivered-To: apmail-perl-dev-archive@www.apache.org Received: (qmail 88739 invoked from network); 21 Nov 2004 18:58:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 21 Nov 2004 18:58:25 -0000 Received: (qmail 63436 invoked by uid 500); 21 Nov 2004 18:58:22 -0000 Delivered-To: apmail-perl-dev-archive@perl.apache.org Received: (qmail 63425 invoked by uid 500); 21 Nov 2004 18:58:22 -0000 Mailing-List: contact dev-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Delivered-To: mailing list dev@perl.apache.org Received: (qmail 63411 invoked by uid 99); 21 Nov 2004 18:58:22 -0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of radek@karnet.pl designates 62.121.128.10 as permitted sender) Received: from [62.121.128.10] (HELO relay.ceti.pl) (62.121.128.10) by apache.org (qpsmtpd/0.28) with ESMTP; Sun, 21 Nov 2004 10:58:18 -0800 Received: from tau8.ceti.pl (tau8.ceti.pl [62.121.128.18]) by relay.ceti.pl (Postfix) with ESMTP id D6747164061 for ; Sun, 21 Nov 2004 19:58:13 +0100 (CET) Received: from bongo (nat1.daminet.pl [82.139.13.231]) by tau8.ceti.pl (Postfix) with ESMTP id 53BFC15C00B for ; Sun, 21 Nov 2004 19:58:13 +0100 (CET) Date: Sun, 21 Nov 2004 19:58:13 +0100 From: Radoslaw Zielinski To: dev@perl.apache.org Subject: Re: [apr] dropping Apache2/ subdir for APR::* Message-ID: <20041121185813.GC31756@bongo> Mail-Followup-To: dev@perl.apache.org References: <20041102131554.GA7504@bongo> <418834B0.5000401@stason.org> <20041114145109.GA2832@bongo> <41978264.6040704@stason.org> <20041119122229.GA3387@bongo> <419E5CC5.8000304@stason.org> <20041121122255.GB2851@bongo> <41A0C6EF.3090504@stason.org> <20041121172917.GB31756@bongo> <41A0D2B4.1050300@stason.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Sr1nOIr3CvdE5hEN" Content-Disposition: inline In-Reply-To: <41A0D2B4.1050300@stason.org> Organization: independent User-Agent: Mutt/1.5.6i X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N --Sr1nOIr3CvdE5hEN Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Stas Bekman [21-11-2004 18:39]: > Radoslaw Zielinski wrote: [...] >> Simply: we don't have function foo(), we have methods Apache2::*::foo() >> and Apache::*::foo() (the second one introduced by the compat layer). >> If the object $c, mentioned in the URL above is blessed to >> Apache::Connection (or whatever class it is), $c->local_addr returns a >> SOCKADDR_IN object; if it's Apache2::Connection (or whatever), we get >> APR::SocketAddr. > You should really try to write a test script and you will see that this i= s=20 > impossible. Since Apache2 C API will not give you SOCKADDR_IN, because it= =20 > doesn't have an API to give you one. Don't write the whole implementation= =2E=20 > Just take this particular API local_addr and write a test that will show= =20 > that you can't have it working both under mp1 and mp2. How do you want me to write a test script without the implementation? You mean, an extension to what I attached the last time (trapping use() with sub ref in @INC)? Yet it's trivial. 'Apache/Connection.pm' =3D> [ 'Apache::Connection', '...', { local_addr =3D> sub { require Apache2::Connection; require Socket; require APR::SockAddr; my $c =3D shift; # is an Apache::Connection object my $sockaddr =3D Apache2::Connection::local_addr($c); Socket::pack_sockaddr_in($sockaddr->port, Socket::inet_aton($sockaddr->ip_get)); }, ..., } ], Who cares about the C API, since all we need to do is to provide a compatible perl one? Current Apache::compat already does it, the namespace change would just remove the need for calling override_mp2_api. >> The trick is in [1]. > [...] >> [1] The problem is to tell mod_perl's internals, that it should return >> Apache2::* objects for handlers ported to mp2 and Apache::* for these, >> which are not ready. I thought about using a per- or >> directive in httpd.conf. By objects I mean for example $r, >> which PerlHandler::handler() gets as its first argument. > modperl internals are either mp1 or mp2, never both at the same time. So= =20 > mp1 can't return mp2 internals and vice versa. What it returns, is just a variable blessed to a specific class; nothing super-magical in it. I don't know how the information about the class name is stored in perl internals, but I guess it's possible to change it in the run-time (before returning to the handler), as the handler_for_mp1_partially_ported_to_mp2::handler() I mentioned in one of the previous messages would do. > I think you are mislead by still believing that it's possible to run > both at the same time. And this is not the case. mod_perl gives you > the perl API for whatever Apache provides, if Apache doesn't have an > API to do something mod_perl neither mod_perl will. Hm, about running both at the same time: I meant running mp2 and mp1 applications on one mp2-controlled interpreter. --=20 Rados=B3aw Zieli=F1ski [ GPG key: http://radek.karnet.pl/ ] --Sr1nOIr3CvdE5hEN Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (GNU/Linux) iD8DBQFBoOVFvesRuUOywuARAsh5AKCvnTsnAlbKOGwbE5Npa74xZT8o+ACgzRSI rijX+hnWHBn4fnU9Rmz/5bs= =zoHt -----END PGP SIGNATURE----- --Sr1nOIr3CvdE5hEN--