Subject: | Default values don't work in URI::Encode, double_encode currently defaults to off. |
In sub new(), you initialize your input hash with default values:
50 encode_reserved => 0,
...
54 double_encode => 1,
However, after initializing, you immediately overwrite those defaults
with whatever was passed in:
57 if ( ref $in[0] eq 'HASH' ) { $input = $in[0]; }
58 else { $input = {@in}; }
The effect is that double_encode actually defaults to off, unless it is
explicitly enabled when new() is called.
I suggest you replace lines 46 through 58 with this instead:
my %defaults = (
# this module, unlike URI::Escape,
# does not encode reserved characters
encode_reserved => 0,
# Allow Double encoding?
# defaults to YES
double_encode => 1,
);
my $input;
if ( ref $in[0] eq 'HASH' ) { $input = $in[0]; }
else { $input = {@in}; }
foreach my $key ( keys %defaults ) {
next if exists $input->{$key};
$input->{$key} = $defaults{$key};
}
Regards,
-Dan