Re: Preloading Fcntl.pm
In article [EMAIL PROTECTED], Stas Bekman [EMAIL PROTECTED] 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. Cheers, Andrew. -- :: article seven Andrew Green automatic internet [EMAIL PROTECTED] | www.article7.co.uk
Re: Preloading Fcntl.pm
In article [EMAIL PROTECTED], Stas Bekman [EMAIL PROTECTED] 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] 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! Cheers, Andrew. -- :: article seven Andrew Green automatic internet [EMAIL PROTECTED] | www.article7.co.uk
Re: Preloading Fcntl.pm
Andrew Green wrote: In article [EMAIL PROTECTED], Stas Bekman [EMAIL PROTECTED] 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! _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://ticketmaster.com http://apacheweek.com http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
Re: Preloading Fcntl.pm
In article [EMAIL PROTECTED], Stas Bekman [EMAIL PROTECTED] 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). Cheers, Andrew. -- :: article seven Andrew Green automatic internet [EMAIL PROTECTED] | www.article7.co.uk
Re: Preloading Fcntl.pm
Stas Bekman [EMAIL PROTECTED] writes: Jorge Godoy wrote: Stas Bekman [EMAIL PROTECTED] 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(). snip / I stand corrected. I read it just after sending that message. My fingers were faster on the e-mail than on the docs. Sorry :-) See you, -- Godoy. [EMAIL PROTECTED] Solutions Developer - Conectiva Inc. - http://en.conectiva.com Desenvolvedor de Soluções - Conectiva S.A. - http://www.conectiva.com.br msg23409/pgp0.pgp Description: PGP signature
Re: Preloading Fcntl.pm
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, -- IT'S TIME FOR A DIFFERENT KIND OF WEB Jean-Michel Hiver - Software Director [EMAIL PROTECTED] +44 (0)114 221 4968 VISIT HTTP://WWW.MKDOC.COM
Re: Preloading Fcntl.pm
Andrew Green wrote: In article [EMAIL PROTECTED], Stas Bekman [EMAIL PROTECTED] 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). Hmm, how about upgrading modperl? May be it has something to do with the module getting loaded twice (since Apache restarts)? I see that HTML::Entities runs code on require and loads .so, the same goes for Fcntl; I'm not sure whether this $Apache::Server::ReStarting flag was available at mod_perl 1.21 (Check the Changes file), but if it does try to do this: if ( $Apache::Server::ReStarting ) { require Fcntl; } _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://ticketmaster.com http://apacheweek.com http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
Preloading Fcntl.pm
I'm trying to use a startup script to preload a selection of common modules, but am having massive problems with Fcntl. If I use Fcntl (); either in the startup script directly or (worse) in any other modules I try to preload, Apache dies silently and immediately upon restart. Checking the syntax of httpd.conf reveals no problems, and nothing unusual is written to the error log; the only indicator is that subsequent restarts report that shutting down httpd failed, and of course actual web accesses fail. The initial restart claims to have been OK. CPAN suggests my version of Fcntl is up to date. I'm using perl 5.00503 for Apache 1.3.19 on Red Hat 6.2, mod_perl 1.21. Using the module as normal in the scripts themselves works as expected; it's only when I try to preload it that the problem takes place. TIA for any hints, Andrew. -- :: article seven Andrew Green automatic internet [EMAIL PROTECTED] | www.article7.co.uk
Re: Preloading Fcntl.pm
On Monday 10 December 2001 16:21, Andrew Green wrote: I'm trying to use a startup script to preload a selection of common modules, but am having massive problems with Fcntl. If I use Fcntl (); either in the startup script directly or (worse) in any other modules I try to preload, Apache dies silently and immediately upon restart. Have you tried to see if it works without the trailing () ? This explicitly tells Perl not to call Fcntl-import(). In non-buggy Perls, a later instance of use Fcntl without the empty list of params will cause import() to be called nevertheless, but it could be that a in earlier Perls, or perhaps due to a bad interaction with mod_perl, this is not the case in your situation. -- ___ Robin Berjon [EMAIL PROTECTED] -- CTO k n o w s c a p e : // venture knowledge agency www.knowscape.com --- It's better to be quotable than to be honest. -- Tom Stoppard
Re: Preloading Fcntl.pm
In article [EMAIL PROTECTED], Robin Berjon [EMAIL PROTECTED] wrote: Have you tried to see if it works without the trailing () ? I have, yes, and I'm afraid it makes no difference. Thanks anyway, Andrew. -- :: article seven Andrew Green automatic internet [EMAIL PROTECTED] | www.article7.co.uk
Re: Preloading Fcntl.pm
Andrew Green wrote: In article [EMAIL PROTECTED], Robin Berjon [EMAIL PROTECTED] 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. _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://ticketmaster.com http://apacheweek.com http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
Re: Preloading Fcntl.pm
Stas Bekman [EMAIL PROTECTED] 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? See you, -- Godoy. [EMAIL PROTECTED] Solutions Developer - Conectiva Inc. - http://en.conectiva.com Desenvolvedor de Soluções - Conectiva S.A. - http://www.conectiva.com.br msg23393/pgp0.pgp Description: PGP signature
Re: Preloading Fcntl.pm
Jorge Godoy wrote: Stas Bekman [EMAIL PROTECTED] 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 cer tain subroutine or variable names into your pack age. 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_ _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://ticketmaster.com http://apacheweek.com http://singlesheaven.com http://perl.apache.org http://perlmonth.com/