problem calling perl script from SOAP server perl script

P

pj

Hi

I am trying to call a perl script from SOAP server side perl script,
but no luck.

following is the SOAP server perl script where I call other perl
script. read_query function writes to a file okay, but does nothing
for the two system calls after that. Any ideas? thanks in advance

#!/usr/bin/perl

use lib '../lib';

use SOAP::Transport::HTTP;

SOAP::Transport::HTTP::CGI
-> dispatch_to('predictor')
-> handle;

package predictor;

sub read_query{
my $file=$_[0];
open (fileOUT, "> dBDataFiles/$file");

foreach $line (@_)
{
print fileOUT "$line";
}
close (fileOUT);

# Problem:: nothing happens for the nest two system commands.

system ("/bin/echo hello > dBDataFiles/test");
system ("/usr/bin/perl /home/nsf470/out.pl");

return "done"."\n\n";
}
 
P

pj

Hi

I am trying to call a perl script from SOAP server side perl script,
but no luck.

following is the SOAP server perl script where I call other perl
script. read_query function writes to a file okay, but does nothing
for the two system calls after that. Any ideas? thanks in advance

#!/usr/bin/perl

use lib '../lib';

use SOAP::Transport::HTTP;

SOAP::Transport::HTTP::CGI
-> dispatch_to('predictor')
-> handle;

package predictor;

sub read_query{
my $file=$_[0];
open (fileOUT, "> dBDataFiles/$file");

foreach $line (@_)
{
print fileOUT "$line";
}
close (fileOUT);

# Problem:: nothing happens for the nest two system commands.

system ("/bin/echo hello > dBDataFiles/test");
system ("/usr/bin/perl /home/nsf470/out.pl");

The return value of the system calls are 256. Why are they not working ?
 
T

Tad McClellan

pj said:
#!/usr/bin/perl


You should ask for all the help you can get:

use warnings;
use strict;

sub read_query{
my $file=$_[0];
open (fileOUT, "> dBDataFiles/$file");


You should always, yes *always*, check the return value from open():

open(fileOUT, "> dBDataFiles/$file") or
die "could not open 'dBDataFiles/$file' $!";

foreach $line (@_)


Do you _want_ the first iteration to have the same value as what
you put into $file?

Writing the name of the file into the file seems strange to me...

{
print fileOUT "$line";
^ ^
^ ^

You should avoid useless uses of double quotes:

print fileOUT $line;

return "done"."\n\n";


return "done\n\n";
 
P

pj

Tad McClellan said:
pj said:
#!/usr/bin/perl


You should ask for all the help you can get:

use warnings;
use strict;

sub read_query{
my $file=$_[0];
open (fileOUT, "> dBDataFiles/$file");


You should always, yes *always*, check the return value from open():

open(fileOUT, "> dBDataFiles/$file") or
die "could not open 'dBDataFiles/$file' $!";

foreach $line (@_)


Do you _want_ the first iteration to have the same value as what
you put into $file?

Writing the name of the file into the file seems strange to me...

{
print fileOUT "$line";
^ ^
^ ^

You should avoid useless uses of double quotes:

print fileOUT $line;

return "done"."\n\n";


return "done\n\n";


Thanks for the tips. It's still not working, that is system calll is
returning 256. any ideas why? please let me know.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,697
Latest member
AugustNabo

Latest Threads

Top