Return-Path: Delivered-To: apmail-perl-dev-archive@www.apache.org Received: (qmail 14953 invoked from network); 23 Dec 2004 14:33:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 23 Dec 2004 14:33:15 -0000 Received: (qmail 42476 invoked by uid 500); 23 Dec 2004 14:32:16 -0000 Delivered-To: apmail-perl-dev-archive@perl.apache.org Received: (qmail 42464 invoked by uid 500); 23 Dec 2004 14:32:16 -0000 Mailing-List: contact dev-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Delivered-To: mailing list dev@perl.apache.org Received: (qmail 42402 invoked by uid 99); 23 Dec 2004 14:32:15 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=RCVD_BY_IP,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of pratiknaik@gmail.com designates 64.233.170.203 as permitted sender) Received: from rproxy.gmail.com (HELO rproxy.gmail.com) (64.233.170.203) by apache.org (qpsmtpd/0.28) with ESMTP; Thu, 23 Dec 2004 06:32:11 -0800 Received: by rproxy.gmail.com with SMTP id f1so95353rne for ; Thu, 23 Dec 2004 06:32:07 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=NjI23b1hJVLMnRJ+u6Kefm1cwruudicmvu8rrwT6Qs+/0JGmV9dvZj1w3y/r7KBjwYvkuXCd5mhGTGXxUmfpzyYdOE/maQqUjajasoX0bLgUEvdg5+ZE17HBp1ZPLZQizC6gexXF85jff49SjfU+103X1JTumw+k3RS0ugD39wk= Received: by 10.38.102.78 with SMTP id z78mr815293rnb; Thu, 23 Dec 2004 06:32:07 -0800 (PST) Received: by 10.38.76.44 with HTTP; Thu, 23 Dec 2004 06:32:07 -0800 (PST) Message-ID: <9212531d0412230632230b2b15@mail.gmail.com> Date: Thu, 23 Dec 2004 20:02:07 +0530 From: Pratik Reply-To: Pratik To: Stas Bekman Subject: Re: [mp2 bug] Perl*Env issues Cc: Larry Leszczynski , dev@perl.apache.org In-Reply-To: <41CA08D6.90201@stason.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <9212531d04121409477e77d35@mail.gmail.com> <41C0A91C.90305@stason.org> <41C1FB65.6010309@stason.org> <41C21580.4080302@stason.org> <9212531d0412182229723744f5@mail.gmail.com> <41C5C7B1.5090106@stason.org> <9212531d04122209413a652e9a@mail.gmail.com> <41CA08D6.90201@stason.org> X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N > Very nice work, Pratik. The only problem is that it syncs SetEnv|PassEvn > <=> %ENV completely twice for each .., 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 ... Similarly, it uses Perl API for PerlRequire and PerlModule. How can I get the list of %ENV variables that got changed in .., 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; } SvTAINTED_on(*svp); } 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 .., PerlRequire & PerlModule. Thanks, Pratik --- http://pratik.syslock.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org For additional commands, e-mail: dev-help@perl.apache.org