Given a valid JSON string that ends in a newline, the schema() method emits a warning
davidcantrell-bb opened this issue · 3 comments
davidcantrell-bb commented
- JSON::Validator version: 4.10
- Perl version: 5.30.1
- Operating system: Mac OS Catalina
Steps to reproduce the behavior
JSON::Validator->new()->schema(q!{ "type": "object" }
!)
note the newline before the closing quote.
Expected behavior
There should be no warning
Actual behavior
A warning is emitted: Unsuccessful stat on filename containing newline at /blahblah/JSON/Validator.pm line 317.
Suggested fix
Tightly scoped no warnings 'newline';
, something like ...
my $loadable = do {
no warnings 'newline';
(blessed $source && ($source->can('scheme') || $source->isa('Mojo::File')))
|| -f $source
|| (!ref $source && $source =~ /^\w/);
};
abraxxa commented
I just chased this error message for hours until I looked for open issues, thanks!
DrHyde commented
There, have a trivial fix :-)