r64625 - in /trunk/libmouse-perl: ./ debian/ lib/ lib/Mouse/ lib/Mouse/Meta/ lib/Mouse/Meta/Method/ lib/Mouse/Meta/Role/ lib/Mouse/Util/ t/001_mouse/ t/040_type_constraints/

ansgar at users.alioth.debian.org ansgar at users.alioth.debian.org
Sat Nov 6 14:37:41 UTC 2010


Author: ansgar
Date: Sat Nov  6 14:37:25 2010
New Revision: 64625

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=64625
Log:
New upstream release.

Added:
    trunk/libmouse-perl/t/040_type_constraints/016_subtyping_parameterized_types.t
      - copied unchanged from r64622, branches/upstream/libmouse-perl/current/t/040_type_constraints/016_subtyping_parameterized_types.t
Modified:
    trunk/libmouse-perl/Changes
    trunk/libmouse-perl/MANIFEST
    trunk/libmouse-perl/META.yml
    trunk/libmouse-perl/debian/changelog
    trunk/libmouse-perl/lib/Mouse.pm
    trunk/libmouse-perl/lib/Mouse/Exporter.pm
    trunk/libmouse-perl/lib/Mouse/Meta/Attribute.pm
    trunk/libmouse-perl/lib/Mouse/Meta/Class.pm
    trunk/libmouse-perl/lib/Mouse/Meta/Method.pm
    trunk/libmouse-perl/lib/Mouse/Meta/Method/Accessor.pm
    trunk/libmouse-perl/lib/Mouse/Meta/Method/Constructor.pm
    trunk/libmouse-perl/lib/Mouse/Meta/Method/Delegation.pm
    trunk/libmouse-perl/lib/Mouse/Meta/Method/Destructor.pm
    trunk/libmouse-perl/lib/Mouse/Meta/Module.pm
    trunk/libmouse-perl/lib/Mouse/Meta/Role.pm
    trunk/libmouse-perl/lib/Mouse/Meta/Role/Application.pm
    trunk/libmouse-perl/lib/Mouse/Meta/Role/Composite.pm
    trunk/libmouse-perl/lib/Mouse/Meta/Role/Method.pm
    trunk/libmouse-perl/lib/Mouse/Meta/TypeConstraint.pm
    trunk/libmouse-perl/lib/Mouse/Object.pm
    trunk/libmouse-perl/lib/Mouse/PurePerl.pm
    trunk/libmouse-perl/lib/Mouse/Role.pm
    trunk/libmouse-perl/lib/Mouse/Spec.pm
    trunk/libmouse-perl/lib/Mouse/Tiny.pod
    trunk/libmouse-perl/lib/Mouse/Util.pm
    trunk/libmouse-perl/lib/Mouse/Util/TypeConstraints.pm
    trunk/libmouse-perl/lib/Mouse/XS.pod
    trunk/libmouse-perl/t/001_mouse/043-parameterized-type.t

Modified: trunk/libmouse-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/Changes?rev=64625&op=diff
==============================================================================
--- trunk/libmouse-perl/Changes (original)
+++ trunk/libmouse-perl/Changes Sat Nov  6 14:37:25 2010
@@ -1,4 +1,11 @@
 Revision history for Mouse
+
+0.82 2010-11-05 18:12:28
+    [BUG FIXES]
+    * Wrong name for a method in Mouse::Meta::TypeConstraint:
+      s/is_a_subtype_of/is_a_type_of/
+    * $type_constraint->type_parameter didn't return the correct value
+      if it's a subtype of paramterized type constraints
 
 0.81 2010-10-28 21:49:40
     [BUG FIXES]

Modified: trunk/libmouse-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/MANIFEST?rev=64625&op=diff
==============================================================================
--- trunk/libmouse-perl/MANIFEST (original)
+++ trunk/libmouse-perl/MANIFEST Sat Nov  6 14:37:25 2010
@@ -247,6 +247,7 @@
 t/040_type_constraints/010_misc_type_tests.t
 t/040_type_constraints/011_container_type_constraint.t
 t/040_type_constraints/015_enum.t
+t/040_type_constraints/016_subtyping_parameterized_types.t
 t/040_type_constraints/017_subtyping_union_types.t
 t/040_type_constraints/018_custom_parameterized_types.t
 t/040_type_constraints/022_custom_type_errors.t

Modified: trunk/libmouse-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/META.yml?rev=64625&op=diff
==============================================================================
--- trunk/libmouse-perl/META.yml (original)
+++ trunk/libmouse-perl/META.yml Sat Nov  6 14:37:25 2010
@@ -30,4 +30,4 @@
 resources:
   license: http://dev.perl.org/licenses/
   repository: git://git.moose.perl.org/Mouse.git
-version: 0.81
+version: 0.82

Modified: trunk/libmouse-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/debian/changelog?rev=64625&op=diff
==============================================================================
--- trunk/libmouse-perl/debian/changelog (original)
+++ trunk/libmouse-perl/debian/changelog Sat Nov  6 14:37:25 2010
@@ -1,3 +1,9 @@
+libmouse-perl (0.82-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Ansgar Burchardt <ansgar at debian.org>  Sat, 06 Nov 2010 15:36:57 +0100
+
 libmouse-perl (0.81-1) unstable; urgency=low
 
   * New upstream release.

Modified: trunk/libmouse-perl/lib/Mouse.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/lib/Mouse.pm?rev=64625&op=diff
==============================================================================
--- trunk/libmouse-perl/lib/Mouse.pm (original)
+++ trunk/libmouse-perl/lib/Mouse.pm Sat Nov  6 14:37:25 2010
@@ -3,7 +3,7 @@
 
 use Mouse::Exporter; # enables strict and warnings
 
-our $VERSION = '0.81';
+our $VERSION = '0.82';
 
 use Carp         qw(confess);
 use Scalar::Util qw(blessed);
@@ -155,7 +155,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.81
+This document describes Mouse version 0.82
 
 =head1 SYNOPSIS
 

Modified: trunk/libmouse-perl/lib/Mouse/Exporter.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/lib/Mouse/Exporter.pm?rev=64625&op=diff
==============================================================================
--- trunk/libmouse-perl/lib/Mouse/Exporter.pm (original)
+++ trunk/libmouse-perl/lib/Mouse/Exporter.pm Sat Nov  6 14:37:25 2010
@@ -268,7 +268,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.81
+This document describes Mouse version 0.82
 
 =head1 SYNOPSIS
 

Modified: trunk/libmouse-perl/lib/Mouse/Meta/Attribute.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/lib/Mouse/Meta/Attribute.pm?rev=64625&op=diff
==============================================================================
--- trunk/libmouse-perl/lib/Mouse/Meta/Attribute.pm (original)
+++ trunk/libmouse-perl/lib/Mouse/Meta/Attribute.pm Sat Nov  6 14:37:25 2010
@@ -342,7 +342,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.81
+This document describes Mouse version 0.82
 
 =head1 DESCRIPTION
 

Modified: trunk/libmouse-perl/lib/Mouse/Meta/Class.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/lib/Mouse/Meta/Class.pm?rev=64625&op=diff
==============================================================================
--- trunk/libmouse-perl/lib/Mouse/Meta/Class.pm (original)
+++ trunk/libmouse-perl/lib/Mouse/Meta/Class.pm Sat Nov  6 14:37:25 2010
@@ -468,7 +468,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.81
+This document describes Mouse version 0.82
 
 =head1 DESCRIPTION
 

Modified: trunk/libmouse-perl/lib/Mouse/Meta/Method.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/lib/Mouse/Meta/Method.pm?rev=64625&op=diff
==============================================================================
--- trunk/libmouse-perl/lib/Mouse/Meta/Method.pm (original)
+++ trunk/libmouse-perl/lib/Mouse/Meta/Method.pm Sat Nov  6 14:37:25 2010
@@ -54,7 +54,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.81
+This document describes Mouse version 0.82
 
 =head1 DESCRIPTION
 

Modified: trunk/libmouse-perl/lib/Mouse/Meta/Method/Accessor.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/lib/Mouse/Meta/Method/Accessor.pm?rev=64625&op=diff
==============================================================================
--- trunk/libmouse-perl/lib/Mouse/Meta/Method/Accessor.pm (original)
+++ trunk/libmouse-perl/lib/Mouse/Meta/Method/Accessor.pm Sat Nov  6 14:37:25 2010
@@ -183,7 +183,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.81
+This document describes Mouse version 0.82
 
 =head1 SEE ALSO
 

Modified: trunk/libmouse-perl/lib/Mouse/Meta/Method/Constructor.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/lib/Mouse/Meta/Method/Constructor.pm?rev=64625&op=diff
==============================================================================
--- trunk/libmouse-perl/lib/Mouse/Meta/Method/Constructor.pm (original)
+++ trunk/libmouse-perl/lib/Mouse/Meta/Method/Constructor.pm Sat Nov  6 14:37:25 2010
@@ -232,7 +232,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.81
+This document describes Mouse version 0.82
 
 =head1 SEE ALSO
 

Modified: trunk/libmouse-perl/lib/Mouse/Meta/Method/Delegation.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/lib/Mouse/Meta/Method/Delegation.pm?rev=64625&op=diff
==============================================================================
--- trunk/libmouse-perl/lib/Mouse/Meta/Method/Delegation.pm (original)
+++ trunk/libmouse-perl/lib/Mouse/Meta/Method/Delegation.pm Sat Nov  6 14:37:25 2010
@@ -61,7 +61,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.81
+This document describes Mouse version 0.82
 
 =head1 SEE ALSO
 

Modified: trunk/libmouse-perl/lib/Mouse/Meta/Method/Destructor.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/lib/Mouse/Meta/Method/Destructor.pm?rev=64625&op=diff
==============================================================================
--- trunk/libmouse-perl/lib/Mouse/Meta/Method/Destructor.pm (original)
+++ trunk/libmouse-perl/lib/Mouse/Meta/Method/Destructor.pm Sat Nov  6 14:37:25 2010
@@ -65,7 +65,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.81
+This document describes Mouse version 0.82
 
 =head1 SEE ALSO
 

Modified: trunk/libmouse-perl/lib/Mouse/Meta/Module.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/lib/Mouse/Meta/Module.pm?rev=64625&op=diff
==============================================================================
--- trunk/libmouse-perl/lib/Mouse/Meta/Module.pm (original)
+++ trunk/libmouse-perl/lib/Mouse/Meta/Module.pm Sat Nov  6 14:37:25 2010
@@ -315,7 +315,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.81
+This document describes Mouse version 0.82
 
 =head1 DESCRIPTION
 

Modified: trunk/libmouse-perl/lib/Mouse/Meta/Role.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/lib/Mouse/Meta/Role.pm?rev=64625&op=diff
==============================================================================
--- trunk/libmouse-perl/lib/Mouse/Meta/Role.pm (original)
+++ trunk/libmouse-perl/lib/Mouse/Meta/Role.pm Sat Nov  6 14:37:25 2010
@@ -131,7 +131,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.81
+This document describes Mouse version 0.82
 
 =head1 DESCRIPTION
 

Modified: trunk/libmouse-perl/lib/Mouse/Meta/Role/Application.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/lib/Mouse/Meta/Role/Application.pm?rev=64625&op=diff
==============================================================================
--- trunk/libmouse-perl/lib/Mouse/Meta/Role/Application.pm (original)
+++ trunk/libmouse-perl/lib/Mouse/Meta/Role/Application.pm Sat Nov  6 14:37:25 2010
@@ -206,7 +206,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.81
+This document describes Mouse version 0.82
 
 =head1 SEE ALSO
 

Modified: trunk/libmouse-perl/lib/Mouse/Meta/Role/Composite.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/lib/Mouse/Meta/Role/Composite.pm?rev=64625&op=diff
==============================================================================
--- trunk/libmouse-perl/lib/Mouse/Meta/Role/Composite.pm (original)
+++ trunk/libmouse-perl/lib/Mouse/Meta/Role/Composite.pm Sat Nov  6 14:37:25 2010
@@ -156,7 +156,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.81
+This document describes Mouse version 0.82
 
 =head1 SEE ALSO
 

Modified: trunk/libmouse-perl/lib/Mouse/Meta/Role/Method.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/lib/Mouse/Meta/Role/Method.pm?rev=64625&op=diff
==============================================================================
--- trunk/libmouse-perl/lib/Mouse/Meta/Role/Method.pm (original)
+++ trunk/libmouse-perl/lib/Mouse/Meta/Role/Method.pm Sat Nov  6 14:37:25 2010
@@ -23,7 +23,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.81
+This document describes Mouse version 0.82
 
 =head1 SEE ALSO
 

Modified: trunk/libmouse-perl/lib/Mouse/Meta/TypeConstraint.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/lib/Mouse/Meta/TypeConstraint.pm?rev=64625&op=diff
==============================================================================
--- trunk/libmouse-perl/lib/Mouse/Meta/TypeConstraint.pm (original)
+++ trunk/libmouse-perl/lib/Mouse/Meta/TypeConstraint.pm Sat Nov  6 14:37:25 2010
@@ -7,31 +7,54 @@
 
     $args{name} = '__ANON__' if !defined $args{name};
 
-    if(defined $args{parent}) {
+    my $type_parameter;
+    if(defined $args{parent}) { # subtyping
         %args = (%{$args{parent}}, %args);
+
         # a child type must not inherit 'compiled_type_constraint'
         # and 'hand_optimized_type_constraint' from the parent
-        delete $args{compiled_type_constraint};
-        delete $args{hand_optimized_type_constraint};
+        delete $args{compiled_type_constraint};       # don't inherit it
+        delete $args{hand_optimized_type_constraint}; # don't inherit it
+
+        $type_parameter = $args{type_parameter};
         if(defined(my $parent_tp = $args{parent}{type_parameter})) {
-            delete $args{type_parameter} if $parent_tp == $args{type_parameter};
+            if($parent_tp != $type_parameter) {
+                $type_parameter->is_a_type_of($parent_tp)
+                    or $class->throw_error(
+                        "$type_parameter is not a subtype of $parent_tp",
+                    );
+            }
+            else {
+                $type_parameter = undef;
+            }
         }
     }
 
     my $check;
 
-    if($check = delete $args{optimized}) {
+    if($check = delete $args{optimized}) { # likely to be builtins
         $args{hand_optimized_type_constraint} = $check;
         $args{compiled_type_constraint}       = $check;
     }
-    elsif(my $param = $args{type_parameter}) {
+    elsif(defined $type_parameter) { # parameterizing
         my $generator = $args{constraint_generator}
-            || $class->throw_error("The $args{name} constraint cannot be used,"
-                . " because $param doesn't subtype from a parameterizable type");
-        # it must be 'constraint'
-        $check = $args{constraint} = $generator->($param);
-    }
-    else {
+            || $class->throw_error(
+                  "The $args{name} constraint cannot be used,"
+                . " because $type_parameter doesn't subtype"
+                . " from a parameterizable type");
+
+        my $parameterized_check = $generator->($type_parameter);
+        if(defined(my $my_check = $args{constraint})) {
+            $check = sub {
+                return $parameterized_check->($_) && $my_check->($_);
+            };
+        }
+        else {
+            $check = $parameterized_check;
+        }
+        $args{constraint} = $check;
+    }
+    else { # common cases
         $check = $args{constraint};
     }
 
@@ -237,7 +260,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.81
+This document describes Mouse version 0.82
 
 =head1 DESCRIPTION
 
@@ -262,7 +285,7 @@
 
 =item C<< $constraint->message >>
 
-=item C<< $constraint->is_a_subtype_of($name or $object) >>
+=item C<< $constraint->is_a_type_of($name or $object) >>
 
 =item C<< $constraint->coerce($value) >>
 

Modified: trunk/libmouse-perl/lib/Mouse/Object.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/lib/Mouse/Object.pm?rev=64625&op=diff
==============================================================================
--- trunk/libmouse-perl/lib/Mouse/Object.pm (original)
+++ trunk/libmouse-perl/lib/Mouse/Object.pm Sat Nov  6 14:37:25 2010
@@ -10,7 +10,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.81
+This document describes Mouse version 0.82
 
 =head1 METHODS
 

Modified: trunk/libmouse-perl/lib/Mouse/PurePerl.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/lib/Mouse/PurePerl.pm?rev=64625&op=diff
==============================================================================
--- trunk/libmouse-perl/lib/Mouse/PurePerl.pm (original)
+++ trunk/libmouse-perl/lib/Mouse/PurePerl.pm Sat Nov  6 14:37:25 2010
@@ -750,7 +750,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.81
+This document describes Mouse version 0.82
 
 =head1 SEE ALSO
 

Modified: trunk/libmouse-perl/lib/Mouse/Role.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/lib/Mouse/Role.pm?rev=64625&op=diff
==============================================================================
--- trunk/libmouse-perl/lib/Mouse/Role.pm (original)
+++ trunk/libmouse-perl/lib/Mouse/Role.pm Sat Nov  6 14:37:25 2010
@@ -1,7 +1,7 @@
 package Mouse::Role;
 use Mouse::Exporter; # enables strict and warnings
 
-our $VERSION = '0.81';
+our $VERSION = '0.82';
 
 use Carp         qw(confess);
 use Scalar::Util qw(blessed);
@@ -137,7 +137,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.81
+This document describes Mouse version 0.82
 
 =head1 SYNOPSIS
 

Modified: trunk/libmouse-perl/lib/Mouse/Spec.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/lib/Mouse/Spec.pm?rev=64625&op=diff
==============================================================================
--- trunk/libmouse-perl/lib/Mouse/Spec.pm (original)
+++ trunk/libmouse-perl/lib/Mouse/Spec.pm Sat Nov  6 14:37:25 2010
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-our $VERSION = '0.81';
+our $VERSION = '0.82';
 
 our $MouseVersion = $VERSION;
 our $MooseVersion = '1.13';
@@ -19,7 +19,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.81
+This document describes Mouse version 0.82
 
 =head1 SYNOPSIS
 

Modified: trunk/libmouse-perl/lib/Mouse/Tiny.pod
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/lib/Mouse/Tiny.pod?rev=64625&op=diff
==============================================================================
--- trunk/libmouse-perl/lib/Mouse/Tiny.pod (original)
+++ trunk/libmouse-perl/lib/Mouse/Tiny.pod Sat Nov  6 14:37:25 2010
@@ -5,7 +5,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.81
+This document describes Mouse version 0.82
 
 =head1 DESCRIPTION
 

Modified: trunk/libmouse-perl/lib/Mouse/Util.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/lib/Mouse/Util.pm?rev=64625&op=diff
==============================================================================
--- trunk/libmouse-perl/lib/Mouse/Util.pm (original)
+++ trunk/libmouse-perl/lib/Mouse/Util.pm Sat Nov  6 14:37:25 2010
@@ -48,7 +48,7 @@
         },
     );
 
-    our $VERSION = '0.81';
+    our $VERSION = '0.82';
 
     my $xs = !(defined(&is_valid_class_name) || $ENV{MOUSE_PUREPERL} || $ENV{PERL_ONLY});
 
@@ -388,7 +388,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.81
+This document describes Mouse version 0.82
 
 =head1 SYNOPSIS
 

Modified: trunk/libmouse-perl/lib/Mouse/Util/TypeConstraints.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/lib/Mouse/Util/TypeConstraints.pm?rev=64625&op=diff
==============================================================================
--- trunk/libmouse-perl/lib/Mouse/Util/TypeConstraints.pm (original)
+++ trunk/libmouse-perl/lib/Mouse/Util/TypeConstraints.pm Sat Nov  6 14:37:25 2010
@@ -427,7 +427,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.81
+This document describes Mouse version 0.82
 
 =head2 SYNOPSIS
 

Modified: trunk/libmouse-perl/lib/Mouse/XS.pod
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/lib/Mouse/XS.pod?rev=64625&op=diff
==============================================================================
--- trunk/libmouse-perl/lib/Mouse/XS.pod (original)
+++ trunk/libmouse-perl/lib/Mouse/XS.pod Sat Nov  6 14:37:25 2010
@@ -5,7 +5,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.81
+This document describes Mouse version 0.82
 
 =head1 DESCRIPTION
 

Modified: trunk/libmouse-perl/t/001_mouse/043-parameterized-type.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/t/001_mouse/043-parameterized-type.t?rev=64625&op=diff
==============================================================================
--- trunk/libmouse-perl/t/001_mouse/043-parameterized-type.t (original)
+++ trunk/libmouse-perl/t/001_mouse/043-parameterized-type.t Sat Nov  6 14:37:25 2010
@@ -1,7 +1,7 @@
-#!/usr/bin/env perl
+#!perl
 use strict;
 use warnings;
-use Test::More tests => 54;
+use Test::More;
 use Test::Exception;
 
 use Tie::Hash;
@@ -222,3 +222,30 @@
 }
 
 is_deeply \%th_clone, \%th, 'the hash iterator is initialized';
+
+{
+    my $myhashref = subtype 'MyHashRef',
+        as 'HashRef[Value]',
+        where { keys %$_ > 1 };
+
+    ok  $myhashref->is_a_type_of('HashRef'), "$myhashref";
+    ok  $myhashref->check({ a => 43, b => 100 });
+    ok  $myhashref->check({ a => 43, b => 3.14 });
+    ok !$myhashref->check({});
+    ok !$myhashref->check({ a => 42, b => [] });
+
+    is $myhashref->type_parameter, 'Value';
+
+    $myhashref = subtype 'H', as 'MyHashRef[Int]';
+
+    ok  $myhashref->is_a_type_of('HashRef'), "$myhashref";
+    ok  $myhashref->check({ a => 43, b => 100 });
+    ok !$myhashref->check({ a => 43, b => 3.14 });
+    ok !$myhashref->check({});
+    ok !$myhashref->check({ a => 42, b => [] });
+
+    is $myhashref->type_parameter, 'Int';
+}
+
+done_testing;
+




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