Hi all,

I recently decided to plunge back into Mac development in a rather odd way.
I'm attempting to create a JBindery-like tool for perl on MacOS X.  That is,
a way to create stand-alone, double-clickable applications using perl.

I've run across a problem that is plaguing my days and nights.  I get two
icons for the application in the dock!  I've tried multiple approaches but
always get the same results -- I think I may have a fundamental
misunderstanding about how things work under MacOSX.

The symptoms are as follows:  When I double click on the application (a
*.app bundle) in the Finder, I get the normal bouncing icon in the dock.
However, I quickly see another duplicate icon (same as the first) which also
bounces.  When the application starts accepting events (via
RunApplicationEventLoop()), the *second* icon stops bouncing, but the first
one does not.  Selecting the first icon (the one that keeps bouncing) in the
dock does nothing.  Selecting the second icon (the one that stops bouncing)
switches me to the application as expected.  Both icons have the correct
name.  When I quit the application, both icons go away.  One odd thing is
that if I run the application from the Terminal command line (i.e. shell), I
only get a single icon in the dock!

I've tried two different approaches to creating a double-clickable perl
application:

The first involved execl()'ing perl from the binary in the bundle.  I
assumed that overlaying the process image was causing the problem, so I
tried again...

My alternative approach -- embeding the perl interpreter into the
application bundle's binary -- yielded exactly the same results

I'm now quite confused.  If this were the old days, I'd set macsbug
breakpoints in the dock and see what it's doing.  But I'm so far behind the
times, it's sad :( 

Note that in both situations, I had to do a chdir() to the directory
containing the application bundle binary to get the application to work.
I'm not sure why this is required, and think (hope?) that the double-icon
problem may be related to this.

FY, I'm running under MacOSX 10.1.1 and using Inline::C to embed the C-glue
to the Carbon frameworks.  My so-called perl-application is very simple --
it just creates a few menus and calls RunApplicationEventLoop().

Cheers,
Rob
............................................................................
Robert S. Mah
Decibel Software, Inc.
[EMAIL PROTECTED]


Reply via email to