Question

Locked

Tomcat-Perl-Perl

By parani.raj ·
Hi,

I am having two Perl scripts [Hello.pl and Hi.pl]

Hello.pl

#!/usr/bin/perl
printf "Hello world";
system("perl Hi.pl")


Hi.pl

#!/usr/bin/perl
printf "Hi";


When I tried to execute the script "Hello.pl" in command prompt,the output is as below

\Perl\bin>perl hello.pl
Hello world
Hi


I kept this two scripts in TOMCAT and tried to invoke the Script[Hello.pl] through a HTML page.It looks the "Hello.pl" is invoked and generated the output but it failed to invoke the script "Hi.pl".

Can any one of you explain where am I going wrong??

/Parani.

This conversation is currently closed to new comments.

9 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Might be a PATH type issue.

by daveo2000 In reply to Tomcat-Perl-Perl

The first place I would look is to put the statement in "hello.pl"

print("PATH='$ENV{PATH}'\n");

and see if "/usr/bin" is in the path. It might not be. As a security measure, system paths are often excluded from the environment.

Second, put the full path of "hi.pl" in the system call. The sub script may be being invoked from a different directory.

If that still doesn't get it, maybe this is a "channeling" issue. The output from "hi.pl" may be going directly to the output and not back through "hello.pl" in which case you may see "hi" in the tomcat log files.

Please let me know if it is one of these.

Collapse -

a quick thought

by apotheon In reply to Tomcat-Perl-Perl

Have you tried getting more information about what's going on? Determine whether system() is forking to run the Hi.pl process, for instance. Try capturing the return value from system() to determine what it's doing. Put another print statement after the line with system() to see if Hello.pl is ever continuing after the fork.

Collapse -

Good point.

by daveo2000 In reply to a quick thought

If you do get a return code you might need to do the following:

system("stuff");
my $rc = $? >> 8;
print("Error code '$rc'\n") if $rc;

Check the direction of the ">>" since I don't have my Perl bible with me. :) To see the rationale behind this look at the Programming Perl book from O'Reilly and friends under the "system" function. It will give the proper syntax if I screwed it up.

Collapse -

Question for you

by todd.benson In reply to Tomcat-Perl-Perl

Parani,

Did you ever solve your problem relating to Tomcat and PERL? I'm having the same problem and I don't know what is happening.

Collapse -

a question for *you*

by apotheon In reply to Question for you

Have you tried some of the debugging suggestions offered in previous responses here?

Collapse -

reply

by todd.benson In reply to a question for *you*

It turns out it was this and I'm trying to fix it.

[Tue May 29 14:18:49 2007] [error] [client 141.239.36.50] install_driver(Oracle) failed: Can't load '/usr/perl5/site_perl/5.6.1/sun4-solaris-64int/auto/DBD/Oracle/Oracle.so' for module DBracle: ld.so.1: perl: fatal: libnnz10.so: open failed: No such file or directory at /usr/perl5/5.6.1/lib/sun4-solaris-64int/DynaLoader.pm line 206.
[Tue May 29 14:18:49 2007] [error] [client 141.239.36.50] Compilation failed in require at (eval 7) line 3.
[Tue May 29 14:18:49 2007] [error] [client 141.239.36.50] Perhaps a required shared library or dll isn't installed where expected

Collapse -

more questions

by apotheon In reply to reply

What's the OS you're using? It looks like some version of Solaris, judging by the module you're trying to install. Are you actually using Oracle with this?

Unfortunately, I'm not terribly experienced with either Solaris or Oracle, but I know a bit about installing software on unixlike systems, so with some more information I may be able to help.

Collapse -

Solution found

by todd.benson In reply to more questions

It turned out that the problem was related to this problem. See this URL... http://forum.java.sun.com/thread.jspa?threadID=5154685&tstart=30

Check at the very bottom of the page. The problem was related to this...

On a whim, I tried this, and it worked:
ln -s /opt/oracle/instantclient/libnnz10.so /lib/libnnz10.so

My install of instantclient oracle software failed to create a symbolic link for libnnz10.so, so the DBracle couldn't find it and would fail.

Collapse -

excellent

by apotheon In reply to Solution found

simple answer

Back to Web Development Forum
9 total posts (Page 1 of 1)  

Related Discussions

Related Forums