[Parseperl-discuss] PPI::Cache and PPI version
Brought to you by:
adamkennedy
|
From: Chris D. <ch...@cl...> - 2006-10-07 03:44:52
|
I think that the PPI version number should be part of the
PPI::Document MD5 identifier. On my machine, I have a mixture of PPI
SVN trunk and PPI v1.118 from CPAN. I test against both when I work
on Perl::Critic, and use the PPI::Cache to speed things up. However,
due to the recent addition of new PPI::Token::Number subclasses, I
get errors when the cached version is from trunk and I'm running with
the older CPAN code.
For example:
Cannot restore overloading on HASH(0x1a6f574) (package
PPI::Token::Number::Float) (even after a "require
PPI::Token::Number::Float;") at blib/lib/Storable.pm (autosplit into
blib/lib/auto/Storable/_retrieve.al) line 331, at /Users/chris/perl/
lib/perl5/site_perl/PPI/Cache.pm line 238
If the $PPI::VERSION were mixed into the cache ID, then this would
not happen (except to developers working against SVN). This would
lead to wasted disk space (new copies in cache for each PPI version),
but that's a minor inconvenience.
Sound good? It will be very easy to implement.
Alternatively, the cache could store the version number of the last
PPI that accessed it and clear itself if the version numbers don't
match. However, if any part of the cache were not writable this
would cause odd failures which would not occur in the above
implementation.
Chris
--
Chris Dolan, Software Developer, Clotho Advanced Media Inc.
608-294-7900, fax 294-7025, 1435 E Main St, Madison WI 53703
vCard: http://www.chrisdolan.net/ChrisDolan.vcf
Clotho Advanced Media, Inc. - Creators of MediaLandscape Software
(http://www.media-landscape.com/) and partners in the revolutionary
Croquet project (http://www.opencroquet.org/)
|