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

Re: [MacPerl] toolbox gui script crashes MPW Shell




Matthias Ulrich Neeracher wrote:

> "Thomas R. Kimpton" <tkimpton@maned.com> writes:
> >I am a rabid MPW Shell editor fan... I write all my scripts
> >and use them from MPW Shell.  I have no problems with other
> >scripts, and have even done some other gui scripts. However,
> >here is a script that runs under MacPerl, but crashes MPW
> >Shell.
> 
> Hmm, I guess I'll have to add a disclaimer to the docs that running GUI scripts
> with the MPW tool voids your warranty :-)

=head1

When I run a simple script (adapted from the Dragon pp. 199-204)
under MacPerl 19 (5.004):

=cut

#!/usr/local/bin/perl
use Mac::Windows;
use Mac::QuickDraw;
use Mac::Events;
$style = floatProc();
$title = 'Oingo Boingo';
$rect = Rect -> new(75, 75, 425, 425);
$main = MacWindow -> new($rect, $title, 1, $style, 1);
$main -> sethook('redraw' => \&redraw_it
                 );
while ($main -> window()) { WaitNextEvent(); }
END {
    $main -> dispose() if defined($main);
}
sub redraw_it { 
    print "redraw_it called\n"; 
    PaintOval( Rect -> new(105, 15, 245, 60) );
}
__END__

The floatProc() does not appear when run from the 
'Script->Run "Draw0"' menu selection, or when saved as a 
runtime and double clicked.  Under either mode of invokation the 
following message pops up on the "STDERR" Window:

# Can't find loadable object for module Mac::Events in @INC (Seaweed:MacPerl f:lib  Dev:Pseudo)
File 'Seaweed:MacPerl f:lib:Mac:Windows.pm'; Line 367
# BEGIN failed--compilation aborted.
File 'Seaweed:MacPerl f:lib:Mac:Windows.pm'; Line 367
# BEGIN failed--compilation aborted.
File 'Seaweed:MacPerl f:Draw0'; Line 2

When run from the MPW tool the floatProc() window does appear, but the 
cursor is changed to the Camel chugging along on the beachball and the
Window does not respond to any events (the oval is not drawn and I cannot 
even grab the edge for a resize) - the only way out is via Cmd-. to 
kill the shell.

Oddly, the only Windows files associated with MacPerl seem to be
the .pm and .xs files in :lib:, in particlar I don't see anything that
I'd call an object file and there is no Windows.al Autoload file either.

Lines near 367 (where I *am* including pod lines in the count) of my 
copy of Windows.pm are:

365     use Carp;
366     use Mac::Hooks ();
367     use Mac::Events;
368     use Mac::Events qw($CurrentEvent @Event);
369     use Mac::QuickDraw qw(SetPort GlobalToLocal GetClip ClipRect SetClip EraseRect SetCursor);

So, apparently running Mac::Events is incompatible with the MPW perl 
tool, but does installation of the tool preclude the use of 
Mac::Events even from the MacPerl app?

Thanks for any help.

Peter Prymmer
pvhp@forte.com



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch