On Tue, Apr 15, 2008 at 8:28 AM, Mark Blackman <[EMAIL PROTECTED]> wrote:
> modperl_perl_init_ids() which itself eventually does a
>
> sv_setiv(GvSV(gv_fetchpv("$", TRUE, SVt_PV)), ids->pid);
>
> where ids->pid should contain the result of a recent getpid.
>
> *However* I note that in the main perl code perl.c $$ is set
> to be a readonly variable so I suspect, this code *might* need
> to to look more like.
>
> if ((tmpgv = gv_fetchpv("$",TRUE, SVt_PV))) {
> SvREADONLY_off(GvSV(tmpgv));
> sv_setiv(GvSV(tmpgv), ids->pid);
> SvREADONLY_on(GvSV(tmpgv));
> }
>
> - Mark
one could replace the provided ${'$'} with a magic one that doesn't cache
I could write one with TIESCALAR and Inline::C but I think there are better
ways to do it and I don't want to clog up modperl list with first-draft code --
just ignore the cached PID by redefining $$'s FETCH accessor to wrap
get_pid() directly. So what if it will take another millisecond.