/usr/share/perl5/MooseX/Types/JSON.pm is in libmoosex-types-json-perl 1.00-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | package # hide from PAUSE
JSON_DOT_PM;
use base JSON;
package MooseX::Types::JSON;
$MooseX::Types::JSON::VERSION = '1.00';
use strict;
use warnings;
=head1 NAME
MooseX::Types::JSON - JSON datatype for Moose
=head1 SYNOPSIS
package Foo;
use Moose;
use Moose::Util::TypeConstraints;
use MooseX::Types::JSON qw( JSON );
has config => ( is => 'rw', isa => JSON );
has options => ( is => 'rw', isa => relaxedJSON );
String type constraints that match valid and relaxed JSON. For the meaning of
'relaxed' see L<JSON>. All the heavy lifting in the background is also
done by L<JSON>.
Coercions from Defined types are included.
=over
=item * JSON
A Str that is valid JSON.
=item * relaxedJSON
A Str that is 'relaxed' JSON. For the meaning of 'relaxed' see L<JSON>.
=back
=cut
use MooseX::Types -declare => [qw/ JSON relaxedJSON /];
use Moose::Util::TypeConstraints;
subtype JSON,
as "Str",
where { ref( eval { JSON_DOT_PM->new->decode($_) } ) ne '' },
message { "Must be valid JSON" };
coerce JSON,
from 'Defined',
via { JSON_DOT_PM->new->allow_nonref->encode($_) };
subtype relaxedJSON,
as "Str",
where { ref( eval { JSON_DOT_PM->new->relaxed->decode($_) } ) ne '' },
message { "Must be at least relaxed JSON" };
coerce relaxedJSON,
from 'Defined',
via { JSON_DOT_PM->new->allow_nonref->encode($_) };
=head1 CONTRIBUTORS
Steve Huff
=head1 AUTHOR
Michael Langner
=head1 CONTRIBUTING
If you'd like to contribute, just fork my repository
(L<http://github.com/cpan-mila/perl-moosex-types-json>)
on Github, commit your changes and send me a pull request.
=head1 BUGS
Please report any bugs or feature requests at
L<http://github.com/cpan-mila/perl-moosex-types-json/issues>.
=head1 COPYRIGHT & LICENSE
Copyright 2014 Michael Langner, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the
same terms as Perl itself.
=cut
1; # track-id: 3a59124cfcc7ce26274174c962094a20
|