At 14:19 -0800 2002.11.28, Michael G Schwern wrote:
>I'd like either Test::Harness or Module::Build (not sure which) to try to
>figure out if `$^X ...` is going to work on MacPerl so it can warn the user
>that 'Build test' isn't going to work rather than simply vomit when it tries
>to run the tests.  So is there a way to determine if ToolServer is running?
>Or should I just do a `$^X -e 'print "Test"'` probe?

You can do:

        use Mac::MoreFiles;
        print $Application{MPSX};  # MPSX == ToolServer creator code

That gives the path to ToolServer, or undef if no ToolServer.  However,
that doesn't tell you if ToolServer is configured properly, or if perl is
available to it.

I might recommend instead:

        $can_do = `which perl \xB3 Dev:Null`;  # \xB3 is the STDERR redirect

It will return the path to the perl executable if ToolServer is available
*and* perl is available.  It will return undef or the empty string
otherwise.  But the probe you mention should be fine, too.


* Note that under the MacPerl app, $^X eq "MacPerl", so it cannot be used
to invoke perl under ToolServer.  You just need to use "perl" and hope the
user didn't change the name of the perl tool for MPW.  Maybe do:

        my $exe;
        for ($^X, 'perl') {
                $exe = $_, last if `which $_`; # or print "Test" probe ...
        }

The perl test suite etc. doesn't need to care about the MacPerl app, only
the perl tool, but if you are looking to make modules installable via a
generic interface for MacPerl users, it should be able to work from the
MacPerl app, and without ToolServer, else it won't really help much, since
most users won't have ToolServer, let alone MPW.


Hope that helps; let me know if you need more information.

-- 
Chris Nandor                      [EMAIL PROTECTED]    http://pudge.net/
Open Source Development Network    [EMAIL PROTECTED]     http://osdn.com/

Reply via email to