• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
running a perl script with RunTime.Exec causes perl script to die
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

running a perl script with RunTime.Exec causes perl script to die


  • Subject: running a perl script with RunTime.Exec causes perl script to die
  • From: Johan Henselmans <email@hidden>
  • Date: Wed, 8 Nov 2006 00:46:20 +0100

I have produced a perl script to do some printing and database housekeeping, which is called using Runtime.Exec.

The script connects to a postgresql database, selects a parent-record via an argument and then prints some information from the children records.

When I run this script from a shell, it runs fine.

However, when I call the script from the webobjects application, I get an error message:
*********************************************
Use of uninitialized value in die at /usr/local/bin/printorder.pl line 282.
Died at /usr/local/bin/printorder.pl line 282.
print retval = 255
**********************************************
Line 282 is the initialization fase of the script, where I try to contact the postgresql database:


**********************************************
280: $statement="select orders.*,ticketype.*,cashregister.* from orders,paydesksession,cashregister,ticketype where order_id ='$ordern\
r' and orders.order_paydesk_session_id = paydesksession_id and paydesksession_cashregister_id=cashregister_id and cashregister_tickettype=\
tickettype_id";


282: 	$sth = $dbh->prepare($statement) or die $dbh->errstr;

284: $sth->execute() or die $dbh->errstr;
************************************************
I use DBI and DBD::Pg to connect to the database, which I upgraded to the latest version in CPAN, development platform is OS X, deployment will be FreeBSD.


The java code that calls the script is:
****************************************

	commands[0] = "/usr/bin/perl";
	commands[1] = "/usr/local/bin/printorder.pl";
	commands[2] = " --ordernr";
	commands[3] = order.orderid().toString();

	   vars[0] = "PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin";
	    vars[1] = "LD_LIBRARY_PATH=$LD_LIBRARY_PATH";

try{
Process p = Runtime.getRuntime().exec(commands, vars);
BufferedReader b = new BufferedReader(new InputStreamReader (p.getInputStream()));
BufferedReader err = new BufferedReader(new InputStreamReader (p.getErrorStream()));
p.waitFor();
while (b.ready())
{
// log.info(b.readLine());
System.out.println(b.readLine());
}
while (err.ready())
{
// log.error(err.readLine());
System.out.println(err.readLine());
}
int retVal = p.exitValue();
// log.info("pdf converter retval = " + retVal);
System.out.println("print retval = " + retVal);
} catch (Throwable p)
{
p.printStackTrace();
}

********************************************************
Is there anybody that has experienced something similar and has come up with a solution?



Is there

Regards,

Johan Henselmans
http://www.netsense.nl
Tel: +31-20-6267538
Fax: +31-20-6273852


_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: running a perl script with RunTime.Exec causes perl script to die
      • From: Patrick Middleton <email@hidden>
    • Re: running a perl script with RunTime.Exec causes perl script to die
      • From: "Daniele Corti" <email@hidden>
  • Prev by Date: Flex 2 and WebObjects Integration
  • Next by Date: Re: WO Networking Woes
  • Previous by thread: Flex 2 and WebObjects Integration
  • Next by thread: Re: running a perl script with RunTime.Exec causes perl script to die
  • Index(es):
    • Date
    • Thread