This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.
To: Andrew Green <andrew@article7.co.uk> From: Stas Bekman <stas@stason.org> Subject: Re: Preloading Fcntl.pm Date: Tue, 11 Dec 2001 01:54:22 +0800 Andrew Green wrote: > In article <01121017211008.18716@morgaine.knowscape.org>, > Robin Berjon <robin@knowscape.com> wrote: > > >>Have you tried to see if it works without the trailing () ? >> > > I have, yes, and I'm afraid it makes no difference. Try to call: require Fcntl; instead. I think the general advise is to always call require() and not use() in startup.pl, unless you have a reason for calling certain modules' import() method. === To: Jorge Godoy <godoy@conectiva.com> From: Stas Bekman <stas@stason.org> Subject: Re: Preloading Fcntl.pm Date: Tue, 11 Dec 2001 12:01:08 +0800 Jorge Godoy wrote: > Stas Bekman <stas@stason.org> writes: > > >>I think the general advise is to always call require() and not use() >>in startup.pl, unless you have a reason for calling certain modules' >>import() method. > Wouldn't that affect mod_perl's advantage of sharing the modules? I > mean, would everything be in it's separate namespace and loaded only > once for every module as it is with use? Please read the doc for use(). perldoc -f use Imports some semantics into the current package from the named module, generally by aliasing certain subroutine or variable names into your package. It is exactly equivalent to BEGIN { require Module; import Module LIST; } use == require + import (almost), and we don't need import() to get the sharing in place. Also see: http://perl.apache.org/guide/perl.html#use_ === To: Andrew Green <andrew@article7.co.uk> From: Stas Bekman <stas@stason.org> Subject: Re: Preloading Fcntl.pm Date: Tue, 11 Dec 2001 18:43:28 +0800 Andrew Green wrote: > In article <3C14F6CE.1070509@stason.org>, > Stas Bekman <stas@stason.org> wrote: > > >>Try to call: >>require Fcntl; >>instead. >> > > Thanks for the tip. I'm afraid the above verbatim produces the following > error on restart: > > | Shutting down http: [ OK ] > | Starting httpd: [Mon Dec 10 20:41:18 2001] [error] syntax error at > | /etc/httpd/lib/perl/modperl.pl line 14, near "require Fcntl" > | BEGIN not safe after errors--compilation aborted at > | /etc/httpd/lib/perl/modperl.pl line 15. > | Syntax error on line 395 of /etc/httpd/conf/httpd.conf: > | syntax error at /etc/httpd/lib/perl/modperl.pl line 14, near "require > | Fcntl" > | BEGIN not safe after errors--compilation aborted at > | /etc/httpd/lib/perl/modperl.pl line 15. > | [FAILED] Weird, what Perl version are you using? Can you do: perl -MFcntl -le1 or perl -le 'require Fcntl' I've tested with 5.6.1, it works. > I should note that /etc/httpd/lib/perl/modperl.pl is my startup script, > and that line 395 of httpd.conf is the PerlRequire directive. Beyond > that, I'm not at all sure whether the above is especially instructive. > > Changing the startup script to: > > require "Fcntl.pm"; > > instead avoids the error, but displays the same > "pretends-to-restart-OK-but-actually-doesn't" behaviour I described > before. I should also mention that trying a PerlModule directive instead > doesn't help either. > > It's very bewildering! === To: modperl@apache.org From: Andrew Green <andrew@article7.co.uk> Subject: Re: Preloading Fcntl.pm Date: Tue, 11 Dec 2001 10:59:09 +0000 (GMT) In article <3C15E350.50106@stason.org>, Stas Bekman <stas@stason.org> wrote: > Weird, what Perl version are you using? Can you do: > perl -MFcntl -le1 > or > perl -le 'require Fcntl' Both seem to work (producing no output, but no errors either). The *really* peculiar thing is that actual scripts that "use Fcntl" work with no problems -- but I can't preload the module, or preload other modules that use it. According to /perl-status, I'm using perl 5.00503 for Apache 1.3.19 on Red Hat 6.2, mod_perl 1.21. On processes that have accessed these scripts, Fcntl shows up on /perl-status?inc and claims to be version 1.03. If it's any help, HTML::Entities displays exactly the same behaviour (and claims to be version 1.22). === To: modperl@apache.org From: Jean-Michel Hiver <jhiver@mkdoc.com> Subject: Re: Preloading Fcntl.pm Date: Tue, 11 Dec 2001 13:06:16 +0000 >> Wouldn't that affect mod_perl's advantage of sharing the modules? I >> mean, would everything be in it's separate namespace and loaded only >> once for every module as it is with use? I don't know about you guys, but I don't feel that sharing the modules is that much of an advantage. If you write large scripts that actually use modules of your own which can be different depending on the version of the script, it means that you cannot run different versions of the script on the same box, which IMHO is not very convenient... Do you know if there's a way to avoid this? Cheers, === To: Jean-Michel Hiver <jhiver@mkdoc.com> From: Stas Bekman <stas@stason.org> Subject: Re: Preloading Fcntl.pm Date: Wed, 12 Dec 2001 00:18:13 +0800 Jean-Michel Hiver wrote: >>>Wouldn't that affect mod_perl's advantage of sharing the modules? I >>>mean, would everything be in it's separate namespace and loaded only >>>once for every module as it is with use? >>> > > I don't know about you guys, but I don't feel that sharing the modules > is that much of an advantage. It is. It can save you a lot of memory. Check the numbers in the performance and scenario chapters of the mod_perl guide. > If you write large scripts that actually > use modules of your own which can be different depending on the version > of the script, it means that you cannot run different versions of the > script on the same box, which IMHO is not very convenient... But this has nothing to do with sharing. You've this problem when you share or not. modperl-2.0 solves this problem. In 1.x you have to use various workarounds, some of the are explained in the guide. === To: modperl@apache.org From: Andrew Green <andrew@article7.co.uk> Subject: Re: Preloading Fcntl.pm Date: Fri, 14 Dec 2001 16:18:31 +0000 (GMT) In article <3C16332A.9060505@stason.org>, Stas Bekman <stas@stason.org> wrote: > Andrew Green wrote: > > The *really* peculiar thing is that actual scripts that "use Fcntl" > > work with no problems -- but I can't preload the module, or preload > > other modules that use it. > Hmm, how about upgrading modperl? I've now finally managed to upgrade mod_perl to 1.23, and the problem has completely disappeared. I didn't even need $Apache::Server::ReStarting (which isn't available on 1.21) to be checked in the end. Many thanks to everyone for your help. ===