perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philippe M. Chiasson" <go...@ectoplasm.org>
Subject use mro;
Date Fri, 21 Dec 2007 18:26:24 GMT
One neat thing about Perl 5.10 is the mro package (Method Resolution Order).

But the neat feature that caught my eye is pkg_gen()

http://search.cpan.org/~rgarcia/perl-5.10.0/lib/mro.pm#mro::get_pkg_gen($classname)

In mod_perl, we use PL_sub_generation to determine if our method cache (handlers)
is still valid. That is unfortunately a single integer that's basically incremented
every time a subroutine is redefined anywhere.

So this means that when, say, Apache::Reload kicks in, it will invalidate
the handler cache we have for every single module, not just the one we just
reloaded.

In 5.10, mro::get_pkg_gen($classname) gives you the same, except at a
package granularity. Pretty cool optimization.

When building against 5.10, we could make use of this I'd think.

Just a thought.

-- 
Philippe M. Chiasson     GPG: F9BFE0C2480E7680 1AE53631CB32A107 88C3A5A5
http://gozer.ectoplasm.org/       m/gozer\@(apache|cpan|ectoplasm)\.org/


Mime
View raw message