Re: Running CGI (Perl) => Can't load module DBI
I found a solution... Instead of setting this in my web.xml: cgi org.apache.catalina.servlets.CGIServlet debug 6 cgiPathPrefix WEB-INF/cgi 5 cgi /cgi-bin/* I added this to my servlet: passShellEnvironment true Now I have access to my environment variables in my perl script (running on the Tomcat server) Alex Mestiashvili wrote: > > Joris Kimpe wrote: >> Hi all, >> >> don't know if this is the correct place, but here it goes... >> >> I've created a cgi script (perl) which need to run in Tomcat 5.5. But >> when >> I try to connect to our database, the error I get is: >> >> install_driver(DB2) failed: Can't load >> 'w:/win32/install/core/CO_PERL/site/lib/auto/DBD/DB2/DB2.dll' for module >> DBD::DB2: load_file:The specified module could not be found at >> w:/win32/install/core/CO_PERL/lib/DynaLoader.pm line 230. >> at (eval 3) line 3 >> Compilation failed in require at (eval 3) line 3. >> Perhaps a required shared library or dll isn't installed where expected >> at >> W:\win32\install\core\CO_TOMCAT\webapps\xtremis\WEB-INF\cgi\present.pl >> line 283 >> >> If I check for the dll, I see that is present in this directory... >> >> If I copy some dll's from C:\Program Files\IBM\SQLLIB\BIN to the same >> directory, it works fine... But I don't think this is the way to do it. >> >> My question now is, how can I set a custom environment variable which I >> can >> use in my perl script (while running in Tomcat). >> >> Thanks! >> >> > Hi , > I am not sure that it will help , but > > for environment variables you can use %ENV hash > > and if you want to define some places with perl modules , you can use > @INC array > > here is an example > #!/usr/bin/perl > > foreach my $val (keys (%ENV) ) { > print $ENV{$val}; > } > > push (@INC,'/usr/lib/my_modules'); > > foreach my $val(@INC) { > print "$val\n"; > } > > $perl env.pl > DCOPRef(konsole-3234,session-6)/local/adm/.Xauthority\h:\w\$ local| > /usr/bin/lesspipe > %s/tmp/ssh-HUJSRj3179/agent.3179/stable/rooten_US.UTF-8root/usr/lib/jvm/jdk1.6.0_05/jreroot1;31/usr/bin/lesspipe > > %s > %s3/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin:/usr/bin/X11:/usr/lib/jvm/jdk1.6.0_0 > > /usr/local/lib/perl/5.10.0 > /usr/local/share/perl/5.10.0 > /usr/lib/perl5 > /usr/share/perl5 > /usr/lib/perl/5.10 > /usr/share/perl/5.10 > /usr/local/lib/site_perl > > or another example (best) which i've found here > http://www.devdaily.com/perl/edu/articles/pl010015/ > > #!/usr/bin/perl > > use lib "/home/george/modules"; > > print "[EMAIL PROTECTED] is @INC\n"; > > $perl inc.pl > @INC is /home/george/modules /etc/perl /usr/local/lib/perl/5.10.0 > /usr/local/share/perl/5.10.0 /usr/lib/perl5 /usr/share/perl5 > /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl . > > > > > - > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Running-CGI-%28Perl%29-%3D%3E-Can%27t-load-module-DBI-tp18341567p18356402.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Running CGI (Perl) => Can't load module DBI
Joris Kimpe wrote: Hi all, don't know if this is the correct place, but here it goes... I've created a cgi script (perl) which need to run in Tomcat 5.5. But when I try to connect to our database, the error I get is: install_driver(DB2) failed: Can't load 'w:/win32/install/core/CO_PERL/site/lib/auto/DBD/DB2/DB2.dll' for module DBD::DB2: load_file:The specified module could not be found at w:/win32/install/core/CO_PERL/lib/DynaLoader.pm line 230. at (eval 3) line 3 Compilation failed in require at (eval 3) line 3. Perhaps a required shared library or dll isn't installed where expected at W:\win32\install\core\CO_TOMCAT\webapps\xtremis\WEB-INF\cgi\present.pl line 283 If I check for the dll, I see that is present in this directory... If I copy some dll's from C:\Program Files\IBM\SQLLIB\BIN to the same directory, it works fine... But I don't think this is the way to do it. My question now is, how can I set a custom environment variable which I can use in my perl script (while running in Tomcat). Thanks! Hi , I am not sure that it will help , but for environment variables you can use %ENV hash and if you want to define some places with perl modules , you can use @INC array here is an example #!/usr/bin/perl foreach my $val (keys (%ENV) ) { print $ENV{$val}; } push (@INC,'/usr/lib/my_modules'); foreach my $val(@INC) { print "$val\n"; } $perl env.pl DCOPRef(konsole-3234,session-6)/local/adm/.Xauthority\h:\w\$ local| /usr/bin/lesspipe %s/tmp/ssh-HUJSRj3179/agent.3179/stable/rooten_US.UTF-8root/usr/lib/jvm/jdk1.6.0_05/jreroot1;31/usr/bin/lesspipe %s %s3/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin:/usr/bin/X11:/usr/lib/jvm/jdk1.6.0_0 /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl or another example (best) which i've found here http://www.devdaily.com/perl/edu/articles/pl010015/ #!/usr/bin/perl use lib "/home/george/modules"; print "[EMAIL PROTECTED] is @INC\n"; $perl inc.pl @INC is /home/george/modules /etc/perl /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl . - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Running CGI (Perl) => Can't load module DBI
Hi all, don't know if this is the correct place, but here it goes... I've created a cgi script (perl) which need to run in Tomcat 5.5. But when I try to connect to our database, the error I get is: install_driver(DB2) failed: Can't load 'w:/win32/install/core/CO_PERL/site/lib/auto/DBD/DB2/DB2.dll' for module DBD::DB2: load_file:The specified module could not be found at w:/win32/install/core/CO_PERL/lib/DynaLoader.pm line 230. at (eval 3) line 3 Compilation failed in require at (eval 3) line 3. Perhaps a required shared library or dll isn't installed where expected at W:\win32\install\core\CO_TOMCAT\webapps\xtremis\WEB-INF\cgi\present.pl line 283 If I check for the dll, I see that is present in this directory... If I copy some dll's from C:\Program Files\IBM\SQLLIB\BIN to the same directory, it works fine... But I don't think this is the way to do it. My question now is, how can I set a custom environment variable which I can use in my perl script (while running in Tomcat). Thanks! -- View this message in context: http://www.nabble.com/Running-CGI-%28Perl%29-%3D%3E-Can%27t-load-module-DBI-tp18341567p18341567.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]