in reply to How to test caching?

  1. Use the perl debugger.
  2. Have some sentinel value (eg "I CAN HAS CASH PLZ.", or a SHA1) that dumps the cache instead of executing your expensive subroutine.
  3. Move state out of the subroutine while testing. Or something like

    { my %cache; sub foo { ... } sub dump_foo { require Data::Dumper; print Data::Dumper::Dumper(\%cache); } }

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.