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

[MacPerl] summary: Howto import modules ...



I'm so glad!
My MacPerl applets can now "use" modules and run without
further installations of files, i.e. real standalone applications.

Effectively this means for me the ability to build programs
which can make use of the lot of wonderful modules and
are distributable to the large amount of Macs I have to
care for.

Here is a summary of the necessary steps

1. Develop your Perl program as usual with MacPerl and save
it as droplet or as plain text.

2. Check the usage of modules with the help of this auxilliary code
foreach (keys %INC) { print "$_\n"; }

3. Remove the auxilliary code

4. Save your program as "Runtime Version"

5. Open the runtime version with ResEdit

6. Create new TEXT resources, copy the content of the modules
into them and name them accordingly
e.g. "Tie/Hash.pm" must be named "Tie:Hash.pm"
"Carp.pm" must be named "Carp.pm"
meaning that UNIXish "/" becomes Mac ":"

7. Save, exit and ready

My example was just a copy program
-------------------------------------------------------------
$BASEDIR = "330:Programmier-Werkzeuge:MacPerl:MacPerl 513Ä";
foreach $entry (@INC) { print "$entry\n"; }
use File::Copy;

$from = "${BASEDIR}:MacPerl Help";
$to = "${BASEDIR}:MacPerl Help Kopie";

copy( $from, $to );

# removed for runtime application
# foreach (keys %INC) { print "$_\n";}

MacPerl::Quit(2);
-------------------------------------------------------------
%INC in this example contained:
Tie/Hash.pm
Config.pm
Mac/MoreFiles.pm
Carp.pm
Exporter.pm
File/Copy.pm
vars.pm
AutoLoader.pm
DynaLoader.pm

After copying my application is 1.2 MB - much better
than 4MB of library files.

Helpful hint:
If MacPerl is complaining "can't find xyz.pm in @INC"
check your preferences or set @INC explicitly by
push (@INC, "your:library:path")

During testing I found two other problems

1)
Starting MacPerl, opening the runtime version and saving
doesn't save the changes. Closing asks again if the user
wants to save changes. Only workaround is to "Save as ..."
and overwriting the existing file.

2)
Executing my example code as a droplet still yields:
"Failed to launch MacPerl (possibly because of a memory problem)"
This was already discussed in the mailing list but no
improvement on my 68k Mac til now (I did hope an upgrade
to 513r2 or ObjectSupportLib 1.2 would help)


Many many thanks to the lot of people who did take time
to help me. This is the real Internet!


Axel

---
Axel Rose              | In the novel I never wrote, I wanted the hero
SPRINGER & JACOBY      | to be a computer programmer because it was the
Werbung GmbH           | most poetic and romantic occupation I could
rose@ sj.com           | think of... -- John Updike, "The Music School"


-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: 2.6ui

mQCPAjE5wsMAAAEEANfcHbM+9qKS/cZpY6EzeXOKelw7VrjPMJRX8F+6warvy8uj
bSccRpniJUWhIN7/bZq9d/GLmSgBw8LMJpGG53mrMZEAPKe+f/idQ6qh8W/xd8XX
ngobFs3xt8gf8ceXrdoerQWmav+m9PnatxLKA1INoT6ErJ7qcVI6JLqiHLglABEB
AAG0IEF4ZWwgUm9zZSA8cm9zZUBpbnRlcm5ldC5zai5jb20+iQCVAgUQMTnDIFI6
JLqiHLglAQGsrAP/dSK8T+5bwqpsRDesSwGRKOxrsb+Ni2d3isQBHdKP7X5X6n3f
aNN0f6N2mU9lGMmo8EIh2zgEC3IIzt0Z7td3VhCTs3zRI4L2eE12FG3j/sORV/Z+
7FVBh61kRLQtJPWEK8zE8QUw2lmCi/Z+Y66VyIfKNCEEt57+8Sxrv5FRWYg=
=LO+R
-----END PGP PUBLIC KEY BLOCK-----



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