Home  |  Linux  | Mysql  | PHP  | XML
From:Ted Zlatanov Date:Wed Aug 13 14:09:02 2008
Subject: Re: Devel::Callsite is a better instance key than join $;,caller()[1,2]
On Fri, 8 Aug 2008 23:41:17 +0100 Ben Morrow <ben@morrow.me.uk> wrote: 

BM> Just use the interpreter address: it's more unique than either pid or
BM> tid, and actually reflects 'Perl-level thread of control'. I would say
BM> that a second function in D::C (what, two whole functions in one module?
BM> Shocking!) to return the interpreter address would be the way to go.

Is this a decent implementation?

IV
context()
    CODE:
	RETVAL = PTR2UV(Perl_get_context());
    OUTPUT:
	RETVAL

It seems *too* simple so I must be forgetting something.

I get paid by the number of CPAN modules released, so yes, this will be
Devel::GetContext, one function per module :)

BM> If you want calls to every(5) to only return true once every five times
BM> even across forked processes, your going to need some sort of IPC,
BM> obviously.

It's actually not hard to do, just tie the hash to a shared memory
segment with Tie::ShareLite and ignore the $$ and context() uniqueness.
But I really doubt Every.pm should provide it, it's a solution in search
of a problem.

Ted

Navigate in group perl.module-authors at sever nntp.perl.org
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by PHP Developer
Powered By PHP Consultants