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??
I'm working on a fairly complicated (for me) collection of code and I would really love for one of the scripts to be able to take a list as one of it's arguments.

The problem is, I've no idea how to make this work both for the user accessing this script from the shell (which is highly likely), and for the scripts that will be calling it. It's easy enough to pass a reference to an array to another script being run, but that's not exactly something that a user will be able to do.

Just for reference, the list is a number of queries that the user wants to run through the program, so it's not a case of trying to stack all my options into an array. I have no advance knowledge of what these queries might be, either. Don't panic, though. They don't get eval'd.

I've been asked to keep my code consistent with the other developers, and they all use Getopt::Long to pull in comand line options, so that's what I'm stuck with.

So, does anyone out there have any suggestions how I can get lists as input through Getopt::Long in the command line and when being run by another script?

-aijin, probably missing something obvious...


In reply to Arrays and GetOpt::Long by aijin

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 admiring the Monastery: (4)
As of 2024-04-24 19:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found