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

[MacPerl] Clarification: Anybody know how to specify environment



It seems I was a bit unclear in the post below. To amplify; how do I give perl
the data for the %ENV hash upon startup.

Setting: starting a script with an apple event from frontier.

The event is specified thus in frontier:
appleEvent (MacPerl.id, 'misc', 'dosc', '----', firstargs,\
 'EXTR', boolean (extract),\
 'DEBG', boolean (debug),\
 'PREP', boolean (preprocess),\
 'MODE', mode,\
 'ENVT', string (environment)))

I«m trying to set the last one here, 'environment'. Stuffing null-terminated strings A and B as exemplified below gives me %ENV{A} == B. Trying for C = D at the same time has me stumped however.

If I got this working I«d have a weblint for the mac by only replacing / with : three places and recoding the 'system(...)' stuff. All parameters and ENV-Vars could be passed from frontier in a combination of finder selection and typed-in switches. Switches can be saved from one pass to the next so mostly you just click the file/folders, select "weblint" from the finder menu and press enter to okay the switches.

Here is a new example frontier command:
MacPerl.doScript(" for $key (keys %ENV){print "$key = $ENV{$key}\\n";} ",\ environment : ("A\x00B\x00\x00\x00C\x00D\x00\x00"))
Which makes macperl print:
A = B
MACPERL = Programmer:verkt¿y:MacPerl Ä:
PERL5LIB = Programmer:verkt¿y:MacPerl Ä:mac_libwww,Programmer:verkt¿y:MacPerl Ä:lib

Any number from 1 to 4 nulls between the first and second pair of letters gives the same result.

At 08:23 01-04-96, haakona@ifi.uio.no wrote:
>Anybody know how to specify environment variables to macperl ?
>
>(in frontier)
>
>I«ve gotten as far as:
>environment = nil;
> environment = environment +("HOME"+char(0)+user.HOME+char(0));
>but when I try to follow up with :
>environment = environment +("TMPDIR" +char(0)+tmpstring+char(0));
>It does not take (yes, tmpstring *is* set).
>
>I«ve tried various permutations with several null bytes inbetween and at
>the end, but no dice ... Pointers to an online doc would be great, this
>*has* to be documented somewhere (?)