r53114 - in /branches/upstream/libmoosex-types-json-perl: ./ current/ current/examples/ current/lib/ current/lib/MooseX/ current/lib/MooseX/Types/ current/t/

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Sat Feb 20 23:08:39 UTC 2010


Author: jawnsy-guest
Date: Sat Feb 20 23:08:27 2010
New Revision: 53114

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=53114
Log:
[svn-inject] Installing original source of libmoosex-types-json-perl

Added:
    branches/upstream/libmoosex-types-json-perl/
    branches/upstream/libmoosex-types-json-perl/current/
    branches/upstream/libmoosex-types-json-perl/current/Changes
    branches/upstream/libmoosex-types-json-perl/current/MANIFEST
    branches/upstream/libmoosex-types-json-perl/current/META.yml
    branches/upstream/libmoosex-types-json-perl/current/Makefile.PL
    branches/upstream/libmoosex-types-json-perl/current/README
    branches/upstream/libmoosex-types-json-perl/current/examples/
    branches/upstream/libmoosex-types-json-perl/current/examples/demo.pl
    branches/upstream/libmoosex-types-json-perl/current/lib/
    branches/upstream/libmoosex-types-json-perl/current/lib/MooseX/
    branches/upstream/libmoosex-types-json-perl/current/lib/MooseX/Types/
    branches/upstream/libmoosex-types-json-perl/current/lib/MooseX/Types/JSON.pm
    branches/upstream/libmoosex-types-json-perl/current/t/
    branches/upstream/libmoosex-types-json-perl/current/t/00-pod.t
    branches/upstream/libmoosex-types-json-perl/current/t/01-json.t

Added: branches/upstream/libmoosex-types-json-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-json-perl/current/Changes?rev=53114&op=file
==============================================================================
--- branches/upstream/libmoosex-types-json-perl/current/Changes (added)
+++ branches/upstream/libmoosex-types-json-perl/current/Changes Sat Feb 20 23:08:27 2010
@@ -1,0 +1,7 @@
+Revision history for MooseX::Types::JSON;
+
+0.02   2009-10-25
+       - Fix whitespace in pod
+
+0.01   2009-10-25
+       - Initial release

Added: branches/upstream/libmoosex-types-json-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-json-perl/current/MANIFEST?rev=53114&op=file
==============================================================================
--- branches/upstream/libmoosex-types-json-perl/current/MANIFEST (added)
+++ branches/upstream/libmoosex-types-json-perl/current/MANIFEST Sat Feb 20 23:08:27 2010
@@ -1,0 +1,9 @@
+Changes
+examples/demo.pl
+lib/MooseX/Types/JSON.pm
+Makefile.PL
+MANIFEST			This list of files
+README
+t/00-pod.t
+t/01-json.t
+META.yml                                 Module meta-data (added by MakeMaker)

Added: branches/upstream/libmoosex-types-json-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-json-perl/current/META.yml?rev=53114&op=file
==============================================================================
--- branches/upstream/libmoosex-types-json-perl/current/META.yml (added)
+++ branches/upstream/libmoosex-types-json-perl/current/META.yml Sat Feb 20 23:08:27 2010
@@ -1,0 +1,16 @@
+--- #YAML:1.0
+name:                MooseX-Types-JSON
+version:             0.02
+abstract:            JSON datatype for Moose
+license:             perl
+author:              
+    - Michael Langner
+generated_by:        ExtUtils::MakeMaker version 6.42
+distribution_type:   module
+requires:     
+    JSON::XS:                      2.00
+    Moose:                         0.82
+    MooseX::Types:                 0.15
+meta-spec:
+    url:     http://module-build.sourceforge.net/META-spec-v1.3.html
+    version: 1.3

Added: branches/upstream/libmoosex-types-json-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-json-perl/current/Makefile.PL?rev=53114&op=file
==============================================================================
--- branches/upstream/libmoosex-types-json-perl/current/Makefile.PL (added)
+++ branches/upstream/libmoosex-types-json-perl/current/Makefile.PL Sat Feb 20 23:08:27 2010
@@ -1,0 +1,16 @@
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+    NAME          => 'MooseX::Types::JSON',
+    VERSION_FROM  => 'lib/MooseX/Types/JSON.pm',
+    ABSTRACT      => 'JSON datatype for Moose',
+    AUTHOR        => 'Michael Langner',
+    LICENSE       => 'perl',
+    PREREQ_PM     => {
+        'MooseX::Types'                => '0.15',
+        'Moose'                        => '0.82',
+        'JSON::XS'                     => '2.00'
+    }
+);
+
+

Added: branches/upstream/libmoosex-types-json-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-json-perl/current/README?rev=53114&op=file
==============================================================================
--- branches/upstream/libmoosex-types-json-perl/current/README (added)
+++ branches/upstream/libmoosex-types-json-perl/current/README Sat Feb 20 23:08:27 2010
@@ -1,0 +1,42 @@
+NAME
+    MooseX::Types::JSON - JSON datatype for Moose
+
+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 JSON::XS. All the heavy lifting in the
+    background is also done by JSON::XS.
+
+    *   JSON
+
+        A Str that is valid JSON.
+
+    *   relaxedJSON
+
+        A Str that is 'relaxed' JSON. For the meaning of 'relaxed' see
+        JSON::XS.
+
+AUTHOR
+    Michael Langner, "<mila at cpan.org>"
+
+BUGS
+    Please report any bugs or feature requests to "bug-moosex-types-json at
+    rt.cpan.org", or through the web interface at
+    <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MooseX-Types-JSON>. I
+    will be notified, and then you'll automatically be notified of progress
+    on your bug as I make changes.
+
+COPYRIGHT & LICENSE
+    Copyright 2009 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.
+

Added: branches/upstream/libmoosex-types-json-perl/current/examples/demo.pl
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-json-perl/current/examples/demo.pl?rev=53114&op=file
==============================================================================
--- branches/upstream/libmoosex-types-json-perl/current/examples/demo.pl (added)
+++ branches/upstream/libmoosex-types-json-perl/current/examples/demo.pl Sat Feb 20 23:08:27 2010
@@ -1,0 +1,19 @@
+#!/usr/bin/perl
+
+{
+    package Foo;
+
+    use Moose;
+    use Moose::Util::TypeConstraints;
+    use MooseX::Types::JSON qw( JSON relaxedJSON );
+    
+    has data_strict  => ( is => 'rw', isa => JSON        );
+    has data_relaxed => ( is => 'rw', isa => relaxedJSON );
+}
+
+my $foo = Foo->new(
+    data_strict  => qq| { "foo": "bar", "answer": "42"  } |,
+    data_relaxed => qq| { "foo": "bar", "answer": "42", } |
+);
+
+print $foo->dump;

Added: branches/upstream/libmoosex-types-json-perl/current/lib/MooseX/Types/JSON.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-json-perl/current/lib/MooseX/Types/JSON.pm?rev=53114&op=file
==============================================================================
--- branches/upstream/libmoosex-types-json-perl/current/lib/MooseX/Types/JSON.pm (added)
+++ branches/upstream/libmoosex-types-json-perl/current/lib/MooseX/Types/JSON.pm Sat Feb 20 23:08:27 2010
@@ -1,0 +1,78 @@
+package MooseX::Types::JSON;
+
+use strict;
+use warnings;
+
+=head1 NAME
+
+MooseX::Types::JSON - JSON datatype for Moose
+
+=cut
+
+our $VERSION = '0.02';
+
+=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::XS>. All the heavy lifting in the background is also
+done by L<JSON::XS>.
+
+=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::XS>. 
+
+=back
+=cut
+
+use MooseX::Types -declare => [qw/ JSON relaxedJSON /];
+use Moose::Util::TypeConstraints;
+use JSON::XS;
+
+subtype JSON,
+  as "Str",
+  where { ref( eval { JSON::XS->new->decode($_) } ) ne '' },
+  message { "Must be valid JSON" };
+
+subtype relaxedJSON,
+  as "Str",
+  where { ref( eval { JSON::XS->new->relaxed->decode($_) } ) ne '' },
+  message { "Must be at least relaxed JSON" };
+
+=head1 AUTHOR
+
+Michael Langner, C<< <mila at cpan.org> >>
+
+=head1 BUGS
+
+Please report any bugs or feature requests to
+C<bug-moosex-types-json at rt.cpan.org>,
+or through the web interface at
+L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MooseX-Types-JSON>.
+I will be notified, and then you'll automatically be notified of progress on
+your bug as I make changes.
+
+=head1 COPYRIGHT & LICENSE
+
+Copyright 2009 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

Added: branches/upstream/libmoosex-types-json-perl/current/t/00-pod.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-json-perl/current/t/00-pod.t?rev=53114&op=file
==============================================================================
--- branches/upstream/libmoosex-types-json-perl/current/t/00-pod.t (added)
+++ branches/upstream/libmoosex-types-json-perl/current/t/00-pod.t Sat Feb 20 23:08:27 2010
@@ -1,0 +1,4 @@
+use Test::More;
+eval "use Test::Pod 1.00";
+plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
+all_pod_files_ok();

Added: branches/upstream/libmoosex-types-json-perl/current/t/01-json.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-json-perl/current/t/01-json.t?rev=53114&op=file
==============================================================================
--- branches/upstream/libmoosex-types-json-perl/current/t/01-json.t (added)
+++ branches/upstream/libmoosex-types-json-perl/current/t/01-json.t Sat Feb 20 23:08:27 2010
@@ -1,0 +1,36 @@
+use Test::More tests => 6;
+
+{
+    package Foo;
+
+    use Moose;
+    use Moose::Util::TypeConstraints;
+    use MooseX::Types::JSON qw( JSON relaxedJSON );
+    
+    has json_strict  => ( is => 'rw', isa => JSON        );
+    has json_relaxed => ( is => 'rw', isa => relaxedJSON );
+}
+
+my $json    = qq| { "foo": "bar", "answer": "42"   } |;
+my $relaxed = qq| { "foo": "bar", "answer": "42",  } |;
+my $nojson  = qq| {                                { |;
+
+my $foo = Foo->new;
+
+eval { $foo->json_strict($json) };
+ok( $@ eq "", "strict => strict" );
+
+eval { $foo->json_strict($relaxed) };
+like( $@, qr/json_strict/, "relaxed => strict" );
+
+eval { $foo->json_relaxed($json) };
+ok( $@ eq "", "strict => relaxed" );
+
+eval { $foo->json_relaxed($relaxed) };
+ok( $@ eq "", "relaxed => relaxed" );
+
+eval { $foo->json_relaxed($nojson) };
+like( $@, qr/json_relaxed/, "nojson => relaxed" );
+
+eval { $foo->json_strict($nojson) };
+like( $@, qr/json_strict/, "nojson => strict" );




More information about the Pkg-perl-cvs-commits mailing list