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

Re: [MacPerl] Compiling Runtime



At 13.22 7/10/97, Strider wrote:
>When I compile a runtime version of an app, it never includes the 'use's
>and 'require's. I'd like to include "x.x"; but it always seems to tell me
>that I don't have to predeclare. What am I doing wrong?

You aren't checking back for several months worth of MacPerl archives!  :-)

Below is an e-mail message containing code that can help.  Use at your own
peril; I'm not sure if it is totally finished code.  Maybe the author can
help/bring us up to date (I don't think much was posted after this)?


--
Chris Nandor             pudge@pobox.com             http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])



From: ziege@ito.umnw.ethz.ch
X-Sender: ziege@baikal.ethz.ch
Mime-Version: 1.0
Date: Sat, 26 Apr 1997 19:42:04 +0200
To: mac-perl@iis.ee.ethz.ch
Subject: Re: [MacPerl] Howto import modules ...
X-MIME-Autoconverted: from quoted-printable to 8bit by err.ethz.ch id TAA09573
Sender: owner-mac-perl@iis.ee.ethz.ch
Precedence: bulk

As the logical next step toward building a standalone app I modified the
droplet slightly so it allows to drop a runtime version and saves the
imported modules as 'TEXT' resources directly into the file:

#"ExtractModules.dp"
#=========================================
#!perl

use Mac::Resources;
use Mac::Memory;

#ARGV now in scalar context (thanks to Bart and Chris)
$res= OpenResFile($ARGV[0]) || die $^E;

#first 'TEXT' resource is source code:
$sourceCodeRes= Get1IndResource('TEXT', 1);
$sourceCodeText= $sourceCodeRes-> get();

#clear the hash:
undef(%INC);

#suppress warnings about redefining subroutines
#by 'eval(use...)':
local $^W = 0;

#angle operator doesn't work here(?):
@sourceCodeText= split /\n/, $sourceCodeText;
for (@sourceCodeText){
        if(/^use.*;/){
                eval($_); #read the %INC
        }
}

$id= 5000;
foreach $libFileName(keys %INC) {
        $aText= "";

        open(libFile, $INC{$libFileName}) or die $^E;
        while(<libFile>){
                $aText.= $_;
        }
        $codeHand= new Handle($aText);

        #UNIX-> Mac Folder
        $libFileName=~ s/\//:/g;
        AddResource($codeHand, 'TEXT', $id, $libFileName) or die $^E;
        WriteResource($codeHand) or die $^E;;
        ReleaseResource($codeHand) or die $^E;;
        $codeHand-> dispose;
        $id++;
        print "Copied module ".$libFileName." into resource fork.\n";
}
CloseResFile($res);
sleep(3);
&MacPerl'Quit(3);

#=======================================================

Michael Ziege
Sallenbachstr. 11
8055 ZŸrich
Switzerland
tel.    ++41-1-463 82 78
e-mail. ziege@ito.umnw.ethz.ch





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