sjh - mountain biking running linux vegan geek spice - mtb / vegan / running / linux / canberra / cycling / etc

Steven Hanley hackergotchi picture Steven




Other online diaries:

Aaron Broughton,
Andrew Pollock,
Anthony Towns,
Chris Yeoh,
Jeremy Kerr,
Martijn van Oosterhout,
Michael Carden,
Michael Davies,
Michael Still,
Tim Potter,
Tony Breeds,


Linux Weekly News,
Girl Genius,
Planet Linux Australia,

Canberra Weather: forecast, radar.

Subscribe: rss, rss2.0, atom

Mon Tue Wed Thu Fri Sat Sun



Archive by month:

Tue, 21 Apr 2009

Another change to cache_timestamps for perl 5.10 - 11:28
Upgrading this server to lenny I finally have perl 5.10 on the system, this caused a problem with my blosxom plugin cache_timestamps. Using File::Find I previously had a sub routine wanted defined inside a scope with some variables available in that scope. However on upgrading to 5.10 this no longer worked.

It used to be something like this

   my (%h1,%h2);
   sub wanted {
      $h1{$File::Find::name} = "someval";
   find (&wanted, "topdir");

However when I changed to perl 5.10 though the assignment seemed to work (blosxom runs without -w or use strict enabled) if I tried to display %h1 inside wanted or tried to use it like a hash I got a weird error "Bizarre copy of HASH in refgen" at the line of code I tried to use the variable as a hash. Looking at other uses of File::Find it seems everyone used anonymous subroutines from the call to find. I have changed the code to do the following.

   my (%h1,%h2);
   find (sub {
      $h1{$File::Find::name} = "someval";
   }, "topdir");

And now the hashes are in scope and not some so called Bizarre copy any more. The code for the cache_timestamps plugin can be found here and details about cache_timestamps are in my comp/blosxom category.

Update: found some details, rather than searching for the error message I started searching for variable scope changes in 5.10. Found this page talking about state variables being available in 5.10 as my variables are not persistent across scope changes.

[/comp/blosxom] link

home, email, rss, rss2.0, atom