valerian wrote: > Hi I'm new at mod_perl, and I decided to start running my scripts with > Apache::PerlRun so I don't have to rewrite them right away (they're too > 'dirty' to run under Apache::Registry). Anyway, I figured it was going > to be easy since PerlRun provides an environment similar to CGI, but > something strange is happening. There's a section in the User Guide that > talks about possible problems one can encounter with referenced > variables, so I figured I'd write a very simple test script to see if > that was the case with my code. > > So the weird thing is that it runs fine the first time, but when I > reload the page, it doesn't show the variable I imported from > My::Config, and this is what the output looks like this: > html_dir = > count = 1 > And this message shows up in the error.log: > [Sat Aug 31 19:59:15 2002] test.pl: Use of uninitialized value at > /home/val/www/cgi-bin/test.pl line 12. > > This is such a simple script, but I can't figure out what I'm doing > wrong. What's even more weird is that if I change my httpd.conf to use > Apache::Registry instead of Apache::PerlRun, the script works fine! > (well the value of $count keeps incrementing, but I expected that). > > Could someone please tell me what I'm doing wrong? My settings/code are > shown below:
Copy-n-pasted your conf and the code and I cannot reproduce the problem with Apache::PerlRun. Do you have this problem when you run the server under 'httpd -X'? What mod_perl version are you using? Try to use the latest one. (though PerlRun didn't change for years). I've tested with: mod_perl 1.27 (perl 5.6.1 and 5.8.0) > ----- httpd.conf ----- > PerlWarn On > PerlTaintCheck On > PerlModule CGI > Alias /cgi-perl/ /home/val/www/cgi-bin/ > <Location /cgi-perl> > SetHandler perl-script > PerlHandler Apache::PerlRun > Options +ExecCGI > allow from all > </Location> > > > ----- test.pl ----- > #!/usr/bin/perl -w > use strict; > use CGI; > use My::Config; > use vars qw($count); > > my $q = new CGI; > > $count++; > > print $q->header(-type=>'text/html'); > print "html_dir = $CF{'html_dir'}<br>"; > print "count = $count<br>"; > > > ----- My/Config.pm ----- > package My::Config; > use strict; > use Exporter; > use vars qw(@ISA @EXPORT %CF); > @ISA = ('Exporter'); > @EXPORT = qw(%CF); > > $CF{'html_dir'} = '/home/val/www/htdocs'; > > 1; -- __________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com