http://www.perlmonks.org?node_id=90075

I was stuck on a tough problem at work a little while ago, and had a nice Perl moment in its resolution.

I'm cleaning up a buggy shopping cart app, and stripping out inconsistent use of hidden fields and cookies in the process, replacing it all with a hash of session data a la Apache::Session. The app uses MySQL and DBI, so of course I headed straight for CPAN to download Apache::Session::MySQL. That module seemed to have a problem with the old version of DBD::mysql installed, so I started looking at the upgrade list...

Unfortunately this site runs in a virtual server environment that makes some upgrades a challenge -- old version of Perl and various libraries, and fear on my part that I could break working sites if I made large changes. I had trouble with mismatched MySQL header files and libraries (don't ask me how my predecessor got DBD::mysql installed previously, but the old version works fine). I struggled with the issue for a few hours, and considered ripping out the session code and trying to get the cookies and hiddens to play well together.

Then the nice moment occurred; with one exception I've always used Apache::Session::MySQL, but there are several implementations. Sure enough, Apache::Session::DB_File installed just fine, and with a few code mutations everything worked as planned.

I made a mental note to not be so fixated in my approaches to problems; if a familiar module doesn't work (because of the environment or because of the nature of the problem) chances are there's still other solutions waiting for us on CPAN.