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

RE: [MacPerl] Two-pass droplet?



>This will work, but a friendlier solution is to use one of the StandardFile
>calls instead of Pick. Then the user can navigate to wherever the file is,
>plus if they're running a standard file enhancer (like ACTION Files or
>whatever it's called), they have that functionality available.
>
>Brian

Brian is right, of course.

Here's how I do it:

    if ($#ARGV < 0) {
        eval "use Mac::StandardFile";
        $file = StandardGetFile('', 'TEXT');
        if ($file->sfGood()) {
            push(@ARGV, $file->sfFile());
        } else {
          exit(1);
        }
    }

Please note that the eval() isn't strictly necessary.  I use it for 
cross-platform compatibility reasons. If you have no reason to suppress 
evaluation until runtime, pull it. Once again this is straight from MPPE, 
Chapter 8, page 124.

# Fungal Parataxonomy                   Mycology Information (Mycoinfo)
# Webmaster, Staff Writer      **The World's First Mycology E-Journal**   
# <mailto:webmaster@mycoinfo.com>            <http://www.mycoinfo.com/> 
#
# First they ignore you. Then they laugh at you. Then they fight you.
# Then you win.                                     --Mohandas Gandhi


===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org