in reply to Re: best way to pass data
in thread best way to pass data

Sorry to be stupid here but how do I get the recieving script to put the stuff into an array to use? I am sending a web page to the second script to process. Ive tried: $uploader = $query->upload("infile"); while (<$uploader>){ push (@import_files, $uploader); } And while (<>){ push (@import_files, shift;); } and six or seven varants, please help. Thanks Rishard

Replies are listed 'Best First'.
Re: Re: Re: best way to pass data
by Anonymous Monk on Aug 23, 2003 at 08:40 UTC
    Found this here:
    http://dbforums.com/arch/95/2002/6/400241
    Basically
    ##Master
    ...some code...
    system ("./slave.pl @array");
    ...end code...

    ##Slave
    @import_array = @ARGV;
    ...code...

    rishard
      Responding to my own post because I only half solved the problem. From Master.pl to Slave.pl, I am sending a bundle of XML files with headers. Since the stuff is passed via the "command line", the XML header errors out so the stuff does not make it to the Slave.pl. I have loaded String::Escape () and still cannot get the information to the array in Slave.pl. Can someone tell me the proper escape proceedure so all the array data arrives intact?
      rishard
        It seems to me that you didn't really read the answers provided.

        Very simply, that code you found is bad advice, and not suited for what you are doing. It will only work for very, very, very simple arrays. There is no good way to escape your XML data properly.

        • As a side note, stop passing xml data on the command line immediately!. It will probably create files (all the > characters will write to files), and may overwrite something important, or shell code within the xml may delete your files!

        If you really want to use the array method, one way is to create a temporary file with your xml data, and pass that filename as an argument. Let me reiterate - Passing the data itself will not work.

        Otherwise, please use one of the other methods suggested in this thread. They are all better ways of doing what you want.