problem calling perl script from SOAP server perl script

Discussion in 'Perl Misc' started by pj, Apr 9, 2004.

  1. pj

    pj Guest

    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";
    }
     
    pj, Apr 9, 2004
    #1
    1. Advertising

  2. pj

    pj Guest

    (pj) wrote in message news:<>...
    > 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 ?
     
    pj, Apr 9, 2004
    #2
    1. Advertising

  3. pj <> wrote:

    > #!/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";


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Apr 9, 2004
    #3
  4. pj

    pj Guest

    Tad McClellan <> wrote in message news:<>...
    > pj <> wrote:
    >
    > > #!/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.
     
    pj, Apr 9, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dpackwood
    Replies:
    3
    Views:
    1,811
  2. Mullin Yu
    Replies:
    0
    Views:
    222
    Mullin Yu
    Oct 8, 2003
  3. Frederik Vanderhaegen

    Soap Extension problem (seems that soap request is not sent to server)

    Frederik Vanderhaegen, Oct 20, 2006, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    272
    Frederik Vanderhaegen
    Oct 20, 2006
  4. kath
    Replies:
    4
    Views:
    648
    J. Gleixner
    Apr 9, 2007
  5. Yogi
    Replies:
    1
    Views:
    434
    Peter Makholm
    Sep 13, 2012
Loading...

Share This Page