[Templates] problems preloading Template.pm under Apache/mod_perl in Mac OS X

Stas Bekman stas@stason.org
Wed, 13 Mar 2002 23:28:07 +0800


Tim Noll wrote:
> A colleague of mine is having trouble preloading Template.pm under
> Apache/mod_perl on Mac OS X. It works fine when called directly within a
> handler module, but if he tries to use it via "PerlModule Template", Apache
> freezes on restart. And if he puts "use Template ();" in a startup file, it
> generates the following error:
> 
> Syntax error on line 1 of /etc/httpd/perl.conf:
> Bareword "O_CREAT" not allowed while "strict subs" in use at
> /Library/Perl/darwin/Template/Document.pm line 251.
> Bareword "O_WRONLY" not allowed while "strict subs" in use at
> /Library/Perl/darwin/Template/Document.pm line 251.
> Bareword "O_TRUNC" not allowed while "strict subs" in use at
> /Library/Perl/darwin/Template/Document.pm line 251.
> Compilation failed in require at /Library/Perl/darwin/Template/Provider.pm
> line 43.
> BEGIN failed--compilation aborted at
> /Library/Perl/darwin/Template/Provider.pm line 43.
> Compilation failed in require at /Library/Perl/darwin/Template.pm line 34.
> BEGIN failed--compilation aborted at /Library/Perl/darwin/Template.pm line
> 34.
> Compilation failed in require at /etc/httpd/startup.pl line 9.
> BEGIN failed--compilation aborted at /etc/httpd/startup.pl line 9.
> Compilation failed in require at (eval 6) line 1.
> 
> His system is:
> Mac OS X 10.1.3
> Perl 5.6.0
> Apache/1.3.22 (Darwin) PHP/4.1.2 mod_perl/1.26 DAV/1.0.3
> 
> Line 1 of /etc/httpd/perl.conf is:
> PerlRequire /etc/httpd/startup.pl
> 
> And the offending line of startup.pl is:
> use Template ();
> 
> Any ideas as to what would cause this?

a broken Exporter?

does it work after you do:

perl -pi -e 's/(O_CREAT|O_WRONLY|O_TRUNC)/Fcntl::$1/g' 
/Library/Perl/darwin/Template/Document.pm

???

Please stay away from perl 5.6.0 -- it's *very* buggy. use 5.6.1 
instead, which is very stable.

_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:stas@stason.org  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/