develooper Front page | perl.perl5.porters | Postings from August 2008

Re: Every.pm on CPAN

Thread Previous | Thread Next
From:
Ted Zlatanov
Date:
August 6, 2008 12:24
Subject:
Re: Every.pm on CPAN
Message ID:
8663qej63b.fsf@lifelogs.com
On Tue, 29 Jul 2008 10:03:48 -0500 Ted Zlatanov <tzz@lifelogs.com> wrote: 

TZ> On Thu, 24 Jul 2008 18:27:50 +0100 Ben Morrow <ben@morrow.me.uk> wrote: 
BM> No, you're calling it wrong :). It returns the opcode the *calling* sub
BM> will return to

TZ> Got it.

BM> Hah! I was trying to avoid the work of testing it properly, &c... :) For
BM> instance, it needs testing under ithreads, under mod_perl, under Win32
BM> pseudoforks... to make sure the behaviour is what you want. I suspect
BM> it's not, and you'll need to include the current interpreter address as
BM> well.

TZ> OK, do I go research that in the C code or can someone help me?

Since I couldn't figure this out (I read about PERL_CONTEXT but didn't
find the interpreter address) I've punted and left the code in a
thread-unsafe state, released to CPAN as Devel::Callsite.

If you have comments or criticism, fire away.

TZ> On Thu, 24 Jul 2008 19:44:37 +0200 Roland Giersig <rgiersig@cpan.org> wrote: 

RG> And how about giving it a parameter ala caller() that specifies the
RG> call-stack-level you want to probe?

TZ> On Thu, 24 Jul 2008 12:39:41 -0500 "David Nicol" <davidnicol@gmail.com> wrote: 

DN> Proposed module name: "callerID" and a variant takes an argument like
DN> caller() to specify how many frames up the stack to go.

TZ> I'm OK with the extra parameter, but please remember I have very little
TZ> experience with the Perl guts.  Someone who does should probably write
TZ> the code and own the module (though I don't mind doing it if needed).
TZ> I don't think it's trivial code in any case, as Ben pointed out there
TZ> are important edge cases.

I couldn't find a way to do this safely, because the line

cx = &cxstack[cxstack_ix];

is not safe to go back an arbitrary number of stack frames.  I need to
know how many we have, and (as with above) I've punted and released it
without this parameter.

Every.pm has been updated to 0.04 and requires Devel::Callsite now.

Thanks to everyone for the help.

Ted


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About