[Pythonmac-SIG] Re: Pythonmac-SIG digest, Vol 1 #440 - 4 msgs

David Pennell dpennell@guardnet.com
Mon, 10 Jul 2000 10:48:28 -0700


>
>In the Perl universe, MacPerl itself presents a similar problem -- it 
>cannot open Perl applets. 
???
You can save a MacPerl script as:
- Plain Text - uses MacPerl to run
- Runtime Version [aka applet] - runs by itself. Can run on machines 
without MacPerl installed. **
- CGI script - uses MacPerl to run
- Droplet. - uses MacPerl to run

All of these can be opened by the MacPerl app. I use Tex-Edit plus, not 
BBEdit, as my MacPerl editor (because I have built a lot of scripts into 
TE+). I certainly have never created anything with MacPerl I couldn't 
open with MacPerl. It shocks me that you think you can't - my question 
is, which version of MacPerl are you using? I have 5.2 r 4. I think I 
have only done one upgrade to get here.

Anyway, MacPerl is much like AppleScript - except it doesn't have, (so 
far as I know) the option of saving an unopenable, uneditable copy. In 
other words, if you send a macperl applet to someone, your code is always 
accessible. Not necessarily true of an AppleScript. But in both, 
typically, you can open an app, script, or droplet and save it as an app, 
script  or droplet. 


>But BBEdit comes to the rescue -- it can 
>edit Perl applets! Hence one can easily debug, modify and generally 
>tweak up scripts and only has to keep the one file around.

BBEdit can do this, as far as I can tell, because MacPerl saves a 
complete script + MacPerl core + compiled binary in each applet. 
Specifically, the binary compiled Perl applet is in the data fork, the 
resource fork contains a basic MacPerl, and the TEXT resource is the 
original script.

The advantage of Python on the Mac is that a Python applet is smaller and 
more portable. I do about 10% of my scripting in Python, even though I am 
more of a perl person, for this very reason.

Essentially if you or someone at python central changed the appbuilder 
applet to add a TEXT resource to the completed applet, containing the 
main python script, I think it would be easy to write a BBEdit plug-in to 
load up a python script.

Right now, it seems to put a .pyc resource in (called "PYC "), dunno if 
thats a full pyc or not. If it is,isn't there some way already to 
decompile in python? If so, instead of looking to BBEdit to do anything, 
it might be easier to make a python droplet to extract the script from an 
applet and then feed it to BBEdit.

================

** Unless you code very carefully to include file manager stuff in your 
applet's start, you can easily have problems running a MacPerl applet on 
a computer without MacPerl (specifically, vanilla perl is fine, but you 
can have troubles with includes. You usually have to send them along, and 
modify the paths somehow. Furthermore, it's really hard (I have found) to 
get the autoloader to properly load in something with an .xs, because 
those are usually compiled on the target machine. 

David Pennell
Audiotex Programmer/Operator
The Register-Guard
PO Box 10188
Eugene, OR 97440-2188
(541)338-2578