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

Re: [MacPerl] sending args to MacPerl



>He'd like to set this up as a standalone MacPerl (not requiring MPW or
>ToolServer) and wants suggestions as to the best way to send in the args
>(and understand their order).

Use the standard file dialogues, with prompts indicating what file
is which, and THEN use the fragment from Todd Smith's message to get
the non-file (define, etc.) argument string(s).

==================== begin source code fragments =====================

if( $MacPerl'Version =~ /Application$/ ) {
        # we're running from the app
        &MacSetup;
}

#
# now pull the arguments from @ARGV as normal, ...
#

#
# rest of application code goes here...
#

sub MacSetup {
        local($cmdLine, @args, $f);
        require "StandardFile.pl";   # includes GUSI
        $f = "foo";
        # call standard file
        $f = &StandardFile'GetFile("Source file", $f);
        die "no input file!\n" if (length ($f) == 0);
        push(@args,"-s $f");
        $f = &StandardFile'PutFile("Output file", $f);
        push(@args,"-o $f);
        unshift( @ARGV, @args );
#
# etc... Note that the result will be null if no file name is
#        selected (for GetFile) or entered (for PutFile), allowing
#        the addition to @args to be conditional for optional items.
#
}

===================== end source code fragments ======================

-----------------------------------------------------------------------
-jn-                             (this mind unintentionally left blank)
-----------------------------------------------------------------------