in reply to ARGV issue.

A pure guess, but it is probably the java rt.exec call that is striping the quotes before they make it to the perl program. You could try escaping them (with backslashes?) before your make the call.


Examine what is said, not who speaks.
Silence betokens consent.
Love the truth but pardon error.

Replies are listed 'Best First'.
Re^2: ARGV issue.
by philiotis (Initiate) on Jan 19, 2005 at 02:15 UTC
    Hi BrowserUk I thought so too at first but that is not the issue. I tried it and my first argument became "This and the last one was test"

      The point is, that between where you specify the command string and where Perl is receiving it, something is splitting the command on whitespace--and it's not Perl!

      Quick look at the Java docs shows that exec( String command ) uses StringTokenizer to do the splitting. As far as my quick look went it doesn't have a mechanism for escaping spaces, and from your test, it passes escape-quoted strings with the quotes intact. :(

      However, just below the form of exec that you are using, the docs describe another form: exec( String[] cmdarray ), which without trying to interpret the (Java) docs, sounds suspiciosly like Perl's list forms of exec and system whereby you pre-tokenize the arguments into the array, and they get passed uninterpreted.

      I suggest you pursue that course.

      (I don't like Java, but their documentation is both thorough and easy to use! Perl(6) could learn a thing or two there)


      Examine what is said, not who speaks.
      Silence betokens consent.
      Love the truth but pardon error.