[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] arguments



At 00:47 96-06-04, Jean-Marc PEZERET wrote:

>1) How to pass arguments to a script, when not used from MPW (I use the
>application only). I know
>how to pass a filename to droplets, but how to pass more ?

This is covered in the MacPerl FAQ, but basically use code like:
    if( $MacPerl'Version =~ /Application$/ ) {
        # we're running from the app
        local( $cmdLine, @args );
        $cmdLine = &MacPerl'Ask( "Enter command line options:" );
        require "shellwords.pl";
        @args = &shellwords( $cmdLine );
        unshift( @ARGV, @args );
    }

You can then process @ARGV as you would under unix.

Remember, the macPerl FAQ is available on CPAN, in the /doc/FAQs/mac/ directory.

--Hal
Hal Wine <hal@dtor.com>     voice: 510/482-0597