Re: "Too long" error due to command line

[email protected] (Nicholas Clark) Thu, 30 Dec 1999 12:27:42 +0000
Newsgroups perl.riscos
Message-ID <[email protected]>
On Fri, Dec 24, 1999 at 03:24:14PM +0100, Vincent Lefevre wrote:
> When I want to start a Perl script with long arguments (about 80 - 90
> characters), I get a "too long" error, either in a Wimp error box, or
> in the taskwindow when there are more characters.
> 
> What can I do?
"Use DDEUtils or buy RISC OS 4"

I think that your problem is because your command line is exceeding 255
characters. (Sum the total length of path to perl binary, path to perl script
and length of arguments).

Moving/symlinking either/both the perl script or the perl binary nearer to $
will work around the problem for a bit by making the paths shorter.
I believe that RISC OS 4 raises the OSCLI limit from 255 to 1023 characters.
If you're not calling your perl script from an obey file you might be best to
investigate the DDEUtils module and the extended command line that it provides.
perl (courtesy of UnixLib) will automatically read these, so all you'd need to
do is make the calling program set an extended command line.

(You can probably even do it from an Obey file if you find an OSCLI SWI module
to set the command line; you can circumvent the direct 255 limit here by using
OS variables, as post RISC OS 2 these are no longer limited to 255 characters.
For that matter you can hack round the problem by bodging your script to take
the names of OS variables that contain the long parameters and using %ENV
to access them.

something like

foreach (@ARGV) {
  s/^<(.*)>$/$ENV{$1}/
}


will expand all <> variables on the command line. (and break any script that
didn't expect this to happen)

[but you'll have to '' quote the < and > marks on the command line to stop them
being interpreted as redirection]

Nick