Subject: | 0 argument erroneously returns undef |
When the string "0" is passed to the encode method, undef is returned
instead of "0". By looking at the code I can see that the same bug also
exists in the decode method.
Sample code that demonstrates the bug:
use URI::Encode qw(uri_encode uri_decode);
my $s = "0";
my $encoded = uri_encode($s, 1);
print "s: $s encoded: $encoded\n";
To correct the bug, the third lines of sub encode and sub decode should
be changed from:
return unless $url;
to:
return $url unless $url;