Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

You say you want to pass a number of items to a script. There are several ways, depending on your point of origin. I get the sense that you want fluidity in your script with changing parameters. IMO, a file would be more cumbersome, where using the standard conventions of an HTTP post and CGI would offer greater ease and flexibility.

Some options, in no order:

  1. If you are posting from an HTML form, this is already done for you in the guise of name=value pairs. You just have to use CGI to parse the string.
  2. You can provide the name=value pairs yourself (you started to show this). E.g., upload.cgi?name1=value1&name2=value2&name3=value3... There's no limit to the number of pairs.
  3. If you are supplying the name=value pairs via file, where does the file come from? Is it uploaded from your local computer via a form or FTP, or created on the server through an editor, e.g., Vim, or some admin HTML form
  4. Or could you use a configuration file and tap it with something like Config::Simple?
  5. Is it a text file or can the name=values be stored in a database?

If you are calling the script from an HTML link or another Perl script, option #2 above would be the easiest. Messing with uploading and maintaining files seems kludgy.

—Brad
"The important work of moving the world forward does not wait to be done by perfect men." George Eliot

In reply to Re: passing a file to a cgi script by bradcathey
in thread passing a file to a cgi script by Angharad

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-04-25 11:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found