RE: MP1 - MP2 migration Problems.
Hello Randy, Hello Perrin, 8-) thanks a lot for your help. I tried to apply the patch , but my compat.pm is a little bit different to the source patch i think. but no problem. i did a manual patch and only applied the namespace row. package Apache; in front ot the sub request { line nothing more, nothing less .. and it WORKS 8-).. Will try with our normal modperl scripts now, but my test.pl script works. thanks again for your help .. and now you have a new patch for the next release 8-) bye Roman -Ursprüngliche Nachricht- Von: Randy Kobes [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 14. Februar 2008 21:56 An: Perrin Harkins Cc: Petry Roman, IT; modperl@perl.apache.org Betreff: Re: MP1 - MP2 migration Problems. On Thu, 14 Feb 2008, Perrin Harkins wrote: On Wed, Feb 13, 2008 at 3:08 PM, Petry Roman, IT [EMAIL PROTECTED] wrote: Looks ok i think. Apache.pm is loaded.. So why can´t i get it to work.. damn thing 8-). This is starting to look like a bug in Apache2::compat to me. I think request() is defined in the wrong namespace. I'll try to make a patch for you to try. Does the attached patch work (untested)? Do you actually use the Apache-request() call? In a Registry script, you can get $r just by calling shift at the beginning of the program. That's a good point. -- best regards, Randy Kobes -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
Re: MP1 - MP2 migration Problems.
Andre, On Wed, 2008-02-13 at 23:00 +0100, André Warnier wrote: Of course, what I forgot to mention below - and sorry if you know that already - is that whichever perl modules you pre-load in your main Apache server config via the startup.pl script, you do not need to use anymore in all your perl scripts or Apache/mod_perl handlers. This is the first time that NOT using use because it was preloaded is mentioned. In fact, how would the modules compile (while testing for example)? (At the cost of having them (insibly) duplicated in all the children processes). Again, this is the first time this is mentioned. It would mean that, say 10 or 20 scripts under mod_perl using DBI,DBD::Oracle,CGI and Template would have the effect of using up to 20 times the memory footprint? Wasn't preloading suposed to do the exact opposite? I'm at a loss here But it may simplify your migration problems, and you can always tune this later. André Regards, Rafael Caceres
Re: MP1 - MP2 migration Problems.
On Wed, Feb 13, 2008 at 3:08 PM, Petry Roman, IT [EMAIL PROTECTED] wrote: Looks ok i think. Apache.pm is loaded.. So why can´t i get it to work.. damn thing 8-). This is starting to look like a bug in Apache2::compat to me. I think request() is defined in the wrong namespace. I'll try to make a patch for you to try. Do you actually use the Apache-request() call? In a Registry script, you can get $r just by calling shift at the beginning of the program. - Perrin
Re: MP1 - MP2 migration Problems.
On Thu, 14 Feb 2008, Perrin Harkins wrote: On Wed, Feb 13, 2008 at 3:08 PM, Petry Roman, IT [EMAIL PROTECTED] wrote: Looks ok i think. Apache.pm is loaded.. So why can´t i get it to work.. damn thing 8-). This is starting to look like a bug in Apache2::compat to me. I think request() is defined in the wrong namespace. I'll try to make a patch for you to try. Does the attached patch work (untested)? Do you actually use the Apache-request() call? In a Registry script, you can get $r just by calling shift at the beginning of the program. That's a good point. -- best regards, Randy KobesIndex: lib/Apache2/compat.pm === --- lib/Apache2/compat.pm (revision 627863) +++ lib/Apache2/compat.pm (working copy) @@ -279,20 +279,6 @@ } } -sub request { -my $what = shift; - -my $r = Apache2::RequestUtil-request; - -unless ($r) { -die cannot use $what , -without 'SetHandler perl-script' , -or 'PerlOptions +GlobalRequest'; -} - -$r; -} - { my $orig_sub = *Apache2::Module::top_module{CODE}; *Apache2::Module::top_module = sub { @@ -321,6 +307,20 @@ package Apache; +sub request { +my $what = shift; + +my $r = Apache2::RequestUtil-request; + +unless ($r) { +die cannot use $what , +without 'SetHandler perl-script' , +or 'PerlOptions +GlobalRequest'; +} + +$r; +} + sub unescape_url_info { my ($class, $string) = @_; Apache2::URI::unescape_url($string);
Re: MP1 - MP2 migration Problems.
On Wed, 13 Feb 2008, Petry Roman, IT wrote: Hello @all, we are just transfering our Intranet Server which used Apache 1.3 and mod_perl1 from SLES8 to SLES10 wiht Apache2 and mod_perl2. There's a couple of documents: http://perl.apache.org/docs/2.0/user/porting/porting.html http://perl.apache.org/docs/2.0/user/porting/compat.html that may help in this regard. -- best regards, Randy Kobes
Re: MP1 - MP2 migration Problems.
Hello Jim, thanks for fast answer, but i still get this erros in the error file of apache, afteri have replaced the parens. [Wed Feb 13 18:02:04 2008] [error] Can't locate object method request via package Apache at /usr/lib/cgi-bin/test1.pl line 4.\n -Ursprüngliche Nachricht- Von: Jim Brandt [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 13. Februar 2008 17:46 An: Petry Roman, IT Cc: modperl@perl.apache.org Betreff: Re: MP1 - MP2 migration Problems. You might try it without the parens: use Apache2::compat; Petry Roman, IT wrote: Hello @all, we are just transfering our Intranet Server which used Apache 1.3 and mod_perl1 from SLES8 to SLES10 wiht Apache2 and mod_perl2. The switch has to go quick and we can´t redesign all of our old mp1 programs to mp2, so we try to use the compat module. But I have no luck with it. I tested my config with SELS10, Opensuse 10.3 and Ubuntu but i hit everytime the same problem. I searched the Mail Archvie and the Documentation, but no luck. I have the following test script.Very simple. test1.pl #!/usr/bin/perl my $r = Apache-request(); $r-send_http_header('text/plain'); $r-print(mod_perl rules!\n); apache2 config looks like this. ScriptAlias /perl/ /usr/lib/cgi-bin/ Location /perl/ # mod_perl mode SetHandler perl-script PerlResponseHandler ModPerl::Registry PerlOptions +ParseHeaders Options +ExecCGI /Location and [EMAIL PROTECTED]:/etc/apache2/conf.d# cat perl.conf PerlRequire /etc/apache2/mod_perl-startup.pl and mod_perl-startup.pl looks like this [EMAIL PROTECTED]:/etc/apache2# cat mod_perl-startup.pl # This file is a placeholder; you can safely ignore or delete it. print startup perl dh; use lib '/usr/lib/perl5/'; # enable if the mod_perl 1.0 compatibility is needed use Apache2::compat (); I get the following output.. Software error: Can't locate object method request via package Apache at /usr/lib/cgi-bin/test1.pl line 4. For help, please send mail to the webmaster ([EMAIL PROTECTED]), giving this error message and the time and date of the error. It seems, he can´t find the requested methods.. How can i validate that the compat module is loaded and working ? if i print the @env array with this perl script i get. #!/usr/bin/perl -w use strict; use CGI::Carp qw(fatalsToBrowser); print Content-type: text/html\n\n; print '!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN', \n; print htmlheadtitleenv array/title/headbody\n; print h1Umgebungsvariablen:/h1\n; print table border=\1\\n; print trth align=\left\ bgcolor=\#E0E0E0\varname/th, th align=\left\ bgcolor=\#E0E0E0\value/th/tr\n; foreach(keys(%ENV)) { print trtdb$_/b/tdtdtt$ENV{$_}/tt/td/tr\n; } print trth align=\left\ bgcolor=\#E0E0E0\ colspan=\2\sum: , scalar keys(%ENV), envarray/th/tr\n; print /table\n; print /body/html\n; here the output... MOD_PERL_API_VERSION 2 PATH /usr/local/bin:/usr/bin:/bin REQUEST_URI /perl/env.pl GATEWAY_INTERFACE CGI/1.1 SERVER_ADDR 172.31.127.193 DOCUMENT_ROOT /var/www/html HTTP_HOST 172.31.127.193 MOD_PERL mod_perl/2.0.2 so i think mod_perl2 is enabled. Any help would be great. bye Roman -- Jim Brandt Administrative Computing Services University at Buffalo -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
Re: MP1 - MP2 migration Problems.
On Feb 13, 2008 9:09 AM, Petry Roman, IT [EMAIL PROTECTED] wrote: Can't locate object method request via package Apache at /usr/lib/cgi-bin/test1.pl line 4. If Apache2::compat is loaded, it should create that namespace. Dump %INC from your script and see if Apache.pm is in it. - Perrin