While I'm working on my new simple test module (Test::Ping), my basic approach at first was "write the minimum, test it and continue from that point using TDD". Later, I figured that Net::Ping already has tests for the functionality, so if I could just port these tests to Test::Ping using its testing functions, that would basically set my tests. I started porting them.
Amongst the tests I recently ported was a Time::HiRes functionality which I did not intend to support, because I thought it would be tricky and pointless for testing anyway. However, I tried to port the test anyway and noticed that unlike other preferences, this time Net::Ping reaches for a package variable instead of an internal hash key. Weird.
I tried accessing the module's package variable through my module and failed miserably. Of course, package modules are global by package, but sometimes very late at night a memory relapse may occur, so I didn't even notice this basic mishap. Instead, I searched for Devel::* to help me find where the variable is. Devel::Symdump just showed me that the variable is $Net::Ping::hires
. How simple.
This is the entire code I had to run to find that out:
perl -MNet::Ping -MDevel::Symdump -le'print Devel::Symdump->rnew("Net::Ping")->as_string;'
Truly, a great language!