"Randy Kobes" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Fri, 5 Dec 2003, SRef wrote: > > > Env: Perl5.8 Apache2.0 mod_perl2.0(1.99xx?) PS: I did try > > to find the solution through mod_perl and apache > > documents, but in vain. Please help me, thanks. > > > > For example, I have a script file named "index.cgi" for my > > website entrance, and there are some template files in the > > same directory with it. index.cgi used to run correctly > > under "use warnings(FATAL => 'all'); use strict....." > > > > when I try using mod_perl, problems occur: > > 1. when access my site http://localhost, it shows error"cann't open > > http://localhost"; I can only use http://localhost/index.cgi, how to sovle > > this? > > This seems like a problem with your Apache configuration - > see the docs at http://httpd.apache.org/ for details.
In my httpd.conf, there is this: ################################################### LoadModule perl_module modules/mod_perl.so PerlRequire "D:/Program Files/Apache Group/Apache2/conf/start_up.pl" PerlSwitches -wT <Directory "D:/website"> Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> <Directory "D:/website/my_mod_perl_path"> SetHandler perl-script PerlResponseHandler ModPerl::Registry Options +ExecCGI PerlOptions +ParseHeaders </Directory> DirectoryIndex index.cgi index.html AddHandler cgi-script .cgi .pl #others remains the default ....... #========================== ###content of start_up.pl use Apache2 (); use ModPerl::Util (); use Apache::RequestRec (); use Apache::RequestIO (); use Apache::RequestUtil (); use Apache::Server (); use Apache::ServerUtil (); use Apache::Connection (); use Apache::Log (); use Apache::Const -compile => ':common'; use APR::Const -compile => ':common'; use APR::Table (); use Apache::compat (); use ModPerl::Registry (); use CGI (); 1; #=========================== > > > 2. it shows many error"sub1 redefined.....sub2 redefined...."when the second > > time or more to access the index.cgi. > > This might be using modules or subroutines whose names > coincide - it's hard to know without seeing a simple > example of your script. I don't think that's the case. Since if I change the subname, eg, sub main() , changed to main1() Then the errorlog will say "main1() redefined....." instead of "main() redefined....". my script example like this: #=========================== use strict; use warnings(FATAL => 'all'); use HTML::Template; use CGI qw(:all); use CGI::Carp qw(fatalsToBrowser); use DBI qw(); .... use lib './'; require 'env.pl'; #env.pl is under same path with index.cgi # Global variables definition====================================================== my $q = new CGI; .....#some globals here main(); sub main(){ sub1(); sub2(); ...... } sub sub1{ ..... } sub sub2{ ..... } ..... #end > > > 3. I use relative path in index.cgi, but it seems all goes mad when > > mod_perl::register reports" can't find file1.tmpl...cann't find file2.tmpl" > > I think when mod_perl::register works the current working directory is > > somewhere else than where index.cgi is. > > then i use chdir to change the working directory to where index.cgi is, > > I just want to know is there any better way to achieve this since we nearly > > always want the current path to be where your script is, rather than > > mod_perl::register . I also wonder if chdir will cause any problem with > > mod_perl::register . > > There's been discussion of this in the past - search the > archives of the mod_perl mailing list (links are available > from http://perl.apache.org/) for a discussion. > Thanks. I will try. > > 4. Another error, mod_perl::register: Unrecognized character \x11 at > > mark.gif. Anything wrong with the gif? > > Does the gif display OK when loaded in a browser? Again, > a simple example illustrating the problem would help. > it's ok when loaded alone in a browser. And actually it's all ok before I use mod_perl. Does mod_perl register parse gif files or do any special thing to them? > > 5. all globle var in index.cgi used to be "my", but it > > says requires explicity package name? I change it to > > "local", same proble occurs. When it be"our", no such > > error any more? I know difference among them in Perl. But > > can anyone explain them to me for mod_perl? Also, why > > mod_perl2.0 documents has no info about this? At least, I > > didn't find. > > Try searching at http://perl.apache.org/ for, for example, > "scoped variable" - this might lead you to what you're > looking for. ok, I will try it. > > > 6. use lib './' doesn't work when second(maybe third?) time invoke > > index.cgi. > > I don't want to put the lib file in perl/lib, nor put the line" use lib > > './' " in "start_up.pl". So is there any way to solve this? > > As with most of the previous questions, it would help quite > a bit to see a short snippet of code illustrating the > problem, what the error logs say, if anything, and the > relevant part of your httpd.conf. > So, I have pasted them above. Hope they will be helpful. Thanks. > -- > best regards, > randy kobes > > -- > Reporting bugs: http://perl.apache.org/bugs/ > Mail list info: http://perl.apache.org/maillist/modperl.html > > -- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html