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

Re: [MacPerl] getopt



>What do I have to do to specify "commandline" options for scripts run under
>the app version? I tried putting them on the "#!" line, but apparently the
>stuff there gets only passed to the app itself and not to my script.
>
>Michael
>
>
>
>***** Want to unsubscribe from this list?
>***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch

Hello,

      I used this sub in one of my scripts.

sub parse_command_line {
    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 );
    }
	&Getopts('o:a:b:');    # command line switches
}


I think that I didn't actually write all of this routine.

Bob

________________________________________________________________
          Bob Wilkinson, Perl Programmer, Pindar plc
Tel: +44 (0)1904 617547    Email: B.Wilkinson@pindar.com
Fax: +44 (0)1904 613110    URL: http://www.connection.co.uk/bob
________________________________________________________________
  I don't speak for my employer - er, they made me say that..
________________________________________________________________



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch