[Chicago-talk] More code that will send me to Perl Purgatory

Dan Rench drench+chipm at gmail.com
Tue Oct 20 15:16:04 PDT 2009


At some point JSON.pm renamed its True() to true() and False() to
false(). If there was a "deprecated" grace period that supported both
it's past. The code I was working on needed to run on a set of servers
with up-to-date JSON, as well as one black sheep that's running all
ancient libraries on Perl 5.6.1. It couldn't get upgraded for various
reasons.

I ended up with this (comments removed because it's more fun that way):

my $JSON_true = eval { JSON::true() } || eval { JSON::True() };
my $JSON_false = eval { JSON::false() };

if (! defined $JSON_false) {
  $JSON_false = eval { JSON::False() };
}

My sympathies to future maintainers.


More information about the Chicago-talk mailing list