mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-19 10:29:30 +01:00
ValidateString: localize $@
This commit is contained in:
parent
d60270192a
commit
eb94c566b9
@ -17,6 +17,7 @@ sub validate_string {
|
|||||||
return $string if not defined $string or not length $string;
|
return $string if not defined $string or not length $string;
|
||||||
$max_length = 1024 * 8 if not defined $max_length;
|
$max_length = 1024 * 8 if not defined $max_length;
|
||||||
|
|
||||||
|
local $@;
|
||||||
eval {
|
eval {
|
||||||
my $h = decode_json($string);
|
my $h = decode_json($string);
|
||||||
foreach my $k (keys %$h) { $h->{$k} = substr $h->{$k}, 0, $max_length unless $max_length <= 0; }
|
foreach my $k (keys %$h) { $h->{$k} = substr $h->{$k}, 0, $max_length unless $max_length <= 0; }
|
||||||
|
Loading…
Reference in New Issue
Block a user