perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pratik <>
Subject Re: [mp2 bug] Perl*Env issues
Date Thu, 23 Dec 2004 14:32:07 GMT
> Very nice work, Pratik. The only problem is that it syncs SetEnv|PassEvn
> <=> %ENV completely twice for each <Perl>..</Perl>, PerlRequire and
> PerlModule, which is not very effective. It would be nice to keep track of
> just what keys have changed.

I need a little help here. MP2 directly uses Perl API call eval_pv()
for <Perl>..</Perl>. Similarly, it uses Perl API for PerlRequire and
PerlModule. How can I get the list of %ENV variables that got changed
in <Perl>..</Perl>, PerlRequire or PerlModule ?

> Regardless, we need to have the tests, since it looks that what you need
> is the right thing.
> Of course it'd be nice to have a more efficient solution.

I tried to populate %ENV on encountering PerlPassEnv & PerlSetEnv, but
"HV *hv = ENVHV;" statement in the new procedure that I wrote ( and
called it on PerlPassEnv and PerlSetEnv ) - gave me segmentation
fault. The procedure was something like below :

void modperl_env_hv_populate(pTHX_ char *key, char *val)
    HV *hv = ENVHV;
    I32 klen = strlen(key);
    SV **svp = hv_fetch(hv, key, klen, FALSE);

    if (svp) {
        sv_setpv(*svp, val);
    else {
        SV *sv = newSVpv(val, 0);
        hv_store(hv, key, klen, sv, FALSE);
        modperl_envelem_tie(sv, key, klen);
        svp = &sv;


Any idea ?

If we populate %ENV on occurance of PerlPassEnv and PerlSetEnv, there
won't be any need modperl_env_sync_tables2env() call and only
modperl_env_sync_env2tables() will be required at the end of every
<Perl>..</Perl>, PerlRequire & PerlModule.



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message