On Wed, 9 Apr 2003, Stas Bekman wrote:
Cron Daemon wrote:
Magic number checking on storable file failed at blib/lib/Storable.pm (autosplit into blib/lib/auto/Storable/_retrieve.al) line 315, at /x1/home/perlwww/apache.org/modperl-docs/bin/../lib/DocSet/Cache.pm line 51
probably a corrupted storable object. I've rebuilt all the cache files from scratch. Also updated Storable while I was at it. Hopefully the problem is resolved now.
Is that something that can be trapped and force a cache purge?
So far I was doing a manual purge: find apache.org/modperl-docs -name "cache*dat" | xargs rm
but you are right that this can be done by docset automatically. I'm going to try the following patch, so when bin/build -f is used the cache files are nuked. This should solve the problem with Storable binary incompatibility.
+++ lib/DocSet/Cache.pm 2003/04/09 04:38:43
@@ -11,7 +11,7 @@
my %attrs = map {$_ => 1} qw(toc meta order child_cache_path); sub new {
- my($class, $path, $update) = @_;
+ my($class, $path, $update, $purge) = @_;die "no cache path specified" unless defined $path;
@@ -19,9 +19,15 @@
path => $path,
dirty => 0,
}, ref($class)||$class;
- $self->read();- if ($update) {
+ if ($purge) {
+ $self->purge();
+ }
+ else {
+ $self->read();
+ }
+
+ if ($purge || update) {
# we will reconstruct the ids order to make sure to reflect the
# changes in added and removed items (and those who have changed
# their order)
@@ -43,6 +49,13 @@
$self->{path};
}+sub purge {
+ if (-e $self->{path}) {
+ note "!!! Removing cache file $self->{path}";
+ unlink $self->{path};
+ }
+}
+
sub read {
my($self) = @_;@@ -102,10 +115,6 @@
return $self->{cache}{$id}{$attr};
}
}
-
-
-
- # check whether a cached entry exists
sub is_cached {
Index: lib/DocSet/DocSet.pm
===================================================================
RCS file: /home/stas/cvs/modules/DocSet/lib/DocSet/DocSet.pm,v
retrieving revision 1.25
diff -u -r1.25 DocSet.pm
--- lib/DocSet/DocSet.pm 2002/11/14 17:35:02 1.25
+++ lib/DocSet/DocSet.pm 2003/04/09 04:38:43
@@ -68,11 +68,18 @@
$self->rebuild(1);
}+ my $purge = 0;
+
# rebuild forces all objects to be rebuilt
- $self->rebuild(1) if DocSet::RunTime::get_opts('rebuild_all');
+ if DocSet::RunTime::get_opts('rebuild_all') {
+ $self->rebuild(1);
+ $purge = 1;
+ } # create the new cache object for updates
- my $cache = DocSet::Cache->new($cache_file, 1);
+ my $update = 1;
+
+ my $cache = DocSet::Cache->new($cache_file, $update, $purge);
$self->cache($cache); # store away# cleanup the cache or rebuild
__________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
