Web Development




By parani.raj ·

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


printf "Hello world";
system("perl Hi.pl")


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

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??


This conversation is currently closed to new comments.

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"


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:

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


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 -


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] 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] Compilation failed in require at (eval 7) line 3.
[Tue May 29 14:18:49 2007] [error] [client] 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 -


by apotheon In reply to Solution found

Related Discussions

Related Forums