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. Advertisements

  2. pj

    pj Guest

    The return value of the system calls are 256. Why are they not working ?
     
    pj, Apr 9, 2004
    #2
    1. Advertisements


  3. You should ask for all the help you can get:

    use warnings;
    use strict;


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

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


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

    ^ ^
    ^ ^

    You should avoid useless uses of double quotes:

    print fileOUT $line;


    return "done\n\n";
     
    Tad McClellan, Apr 9, 2004
    #3
  4. pj

    pj Guest


    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. Advertisements

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 (here). After that, you can post your question and our members will help you out.