expanded IsValid trigger
parent
e8a40171be
commit
997e365633
|
@ -15,14 +15,13 @@ zci is_cached => 1;
|
|||
triggers any => 'json';
|
||||
|
||||
handle remainder => sub {
|
||||
return unless $_ =~ /valid\s*(.*)$/;
|
||||
return unless s/ ?(is )?valid\?? ?//gi;
|
||||
|
||||
my ($result, $error) = try {
|
||||
from_json($1);
|
||||
from_json $_;
|
||||
return 'valid!';
|
||||
} catch {
|
||||
$_ =~ /^(.* at character offset \d+ .*) at/;
|
||||
|
||||
return ('invalid: ', $1);
|
||||
};
|
||||
|
||||
|
|
|
@ -15,10 +15,10 @@ zci is_cached => 1;
|
|||
triggers any => 'xml';
|
||||
|
||||
handle remainder => sub {
|
||||
return unless $_ =~ /valid\s*(.*)$/;
|
||||
return unless s/ ?(is )?valid\?? ?//gi;
|
||||
|
||||
my ($result, $error) = try {
|
||||
XMLin($1);
|
||||
XMLin $_;
|
||||
return 'valid!';
|
||||
} catch {
|
||||
$_ =~ /^\n(.* at line \d+, column \d+, byte \d+) at/;
|
||||
|
|
Loading…
Reference in New Issue