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