I am seeking Enlightnment with my favourite Monks on this bleak day
The short version is: I need to parse a command-line style string into an array. Each flag, option and argument must be an item in the array. Eventually I will use that array in a system(@cmd).
The long version: I have a perl wrapper to command (say ffmpeg). The wrapper processes its cmdline with Getopt::Long. I have the option of --extra-ffmpeg-params STRING-OF-ARGS. The wrapper does some preprocessing and finally calls ffmpeg with IPC::Run::run(@cmd). And @cmd should also contain the extra ffmpeg params passed at the cmdline. But they were passed as a string but I need to turn them into an array. Hmmm.
I have failed to find something like my @args = Getopt::Long::parse($string).
Right now a solution could be to specify the extra params not as a string which is convenient to the user but as a JSON array which is easy to convert to perl array. yikes!
bw, bliako
In reply to Parsing a command-line string into an array by bliako
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |