Skip Menu |

This queue is for tickets about the JSON-Schema CPAN distribution.

Report information
The Basics
Id: 81736
Status: resolved
Priority: 0/
Queue: JSON-Schema

People
Owner: perl [...] toby.ink
Requestors: jabbas [...] jabbas.eu
Cc: bjakubski [...] gmail.com
cybersg [...] gmail.com
gszpetkowski [...] gmail.com
AdminCc:

Bug Information
Severity: Important
Broken in: 0.013
Fixed in: (no value)



CC: bjakubski [...] gmail.com, cybersg [...] gmail.com, gszpetkowski [...] gmail.com
 There is a problem while we want to validate length of the string:

$ perl -MJSON::Schema -e '$s=JSON::Schema->new(q/{"type":"array","items":{"minLength":5,"type":"string"}}/); $a = [qw/a/]; $s->validate($a)'
Unimplemented: POSIX::strlen() is C-specific, use length instead at /usr/lib64/perl5/site_perl/5.12.4/JSON/Schema/Helper.pm line 296
 
On Czw 06 Gru 2012, 03:35:57, jabbas wrote:
Show quoted text
> There is a problem while we want to validate length of the string:
>
> $ perl -MJSON::Schema -e
> '$s=JSON::Schema-
> >new(q/{"type":"array","items":{"minLength":5,"type":"string"}}/);
> $a = [qw/a/]; $s->validate($a)'
> Unimplemented: POSIX::strlen() is C-specific, use length instead at
> /usr/lib64/perl5/site_perl/5.12.4/JSON/Schema/Helper.pm line 296

Workaround is:

use JSON::Schema;
use JSON::Schema::Helper;
*JSON::Schema::Helper::strlen=sub { length @_ };

Thanks for the report. I think perhaps at the time I wrote JSON::Schema::Helper I must have been coding a lot of PHP the day before or something. :-) I'll try to sort this out in the next couple of days.
0.014 should be winging its way to CPAN now.
 Marvelous! Thanks!