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

[MacPerl-Toolbox] Mac::Process::LaunchApplication



This function is supposed to return a list of things (according to the
docs), but it does not.  It returns 1 or 0 instead.  I propose a change for
it to return the PSN if successful, and undef on failure.

Old code:

MacOSRet
LaunchApplication(LaunchParams)
    LaunchParam LaunchParams


New code:

ProcessSerialNumber
LaunchApplication(LaunchParams)
    LaunchParam LaunchParams
    CODE:
    if (gLastMacOSErr = LaunchApplication(LaunchParams)) {
        XSRETURN_UNDEF;
    }
    RETVAL = LaunchParams->launchProcessSN;
    OUTPUT:
    RETVAL

The only problem I forsee is if it is possible that the PSN could be 0;
that would, obviously, break existing code that checked for a boolean
return value.

Another option is to return as documented: a list of PSN, pref. and min.
partition size.  Or maybe even a LaunchParam object.

This code is good if you want to launch an app and then use the PSN for
something.  You can always iterate over %Process, but that is a pain, and
it is especially difficult if the path used to launch is an alias; then you
need to resolve all the aliases before getting the path to match against
... it is easier if you just get the PSN back here.

The end result of this, for me, is that someone can do this:

  $glue = Mac::Glue new "Glue Name" => path => $path;

Then I launch the app in $path, get the PSN, and pack it as the target for
subsequent glue calls with that object.  I also will support these:

  $glue = Mac::Glue new "Glue Name" => psn => $psn;

  $glue = Mac::Glue new "Glue Name" => ppc => $name, $server, $zone;

(ppc and psn are synonyms for 'psn ' and 'targ'.)

Any thoughts or objections (especially from Matthias, since it is his
code)?  I have a working PPC (and an untested CFM68K) build if anyone wants
to play.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

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