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

[MacPerl] Using MPW to create CGIs



A few days ago I asked for help in generating CGI programs using
MPW's build command. The solution worked out nicely once Mathias had
explained that I didn't have to modify any resource except TEXT 128.
I'm now able to generate entire families of CGI's with a single build
command, with the added feature of make's usual intelligence about
what needs to be regenerated. Here's what worked, in case it is
useful to someone else:

One time only:

    Derez the glue:
    
        derez Demo.cgi >cgi.r

    Edit cgi.r to delete the entire definition of the TEXT 128
    resource and replace it with the single line:
    
        read 'TEXT' (128, "!") PERLTEXT;

Note: PERLTEXT will be defined in the rez command line, below, as
a macro that evaluates to the name of a text file.  This is what
rez's "read" command expects: it uses the text file content
to generate the TEXT resource.

Assume that "myscript" is a Perl script that I want to make into a
CGI program called "mycgi". Also, MPW's makefiles use an option-f
character to separate targets from dependencies, and MPW uses an
option-d character to "backslash" a literal. I've represented these
below with <f> and <d> so this message comes through OK on non-Macs.

With these assumptions then, the makefile contains:
    
mycgi <f> myscript cgi.r
    rez -t APPL -c MrPL -d PERLTEXT=<d>"myscript<d>" -o mycgi cgi.r
    
That's it. Repeat the above dependency and rule in the makefile for
whatever targets you want to build. After that: if you make a change
just hit command-B and poof (well, almost poof) they're ready to
execute.
    
    -Paul-       paul.b.patton@hbc.honeywell.com