r38832 - in /branches/upstream/libmoosex-types-perl/current: Changes MANIFEST META.yml lib/MooseX/Types.pm lib/MooseX/Types/TypeDecorator.pm t/20_union_with_string_type.t

ansgar-guest at users.alioth.debian.org ansgar-guest at users.alioth.debian.org
Sat Jun 27 16:32:02 UTC 2009


Author: ansgar-guest
Date: Sat Jun 27 16:31:56 2009
New Revision: 38832

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=38832
Log:
[svn-upgrade] Integrating new upstream version, libmoosex-types-perl (0.14)

Added:
    branches/upstream/libmoosex-types-perl/current/t/20_union_with_string_type.t
Modified:
    branches/upstream/libmoosex-types-perl/current/Changes
    branches/upstream/libmoosex-types-perl/current/MANIFEST
    branches/upstream/libmoosex-types-perl/current/META.yml
    branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types.pm
    branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/TypeDecorator.pm

Modified: branches/upstream/libmoosex-types-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/Changes?rev=38832&op=diff
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/Changes (original)
+++ branches/upstream/libmoosex-types-perl/current/Changes Sat Jun 27 16:31:56 2009
@@ -1,4 +1,7 @@
 Revision history for MooseX-Types
+
+0.14    Fri Jun 26 17:52:20 PDT 2009
+        - Fix union with string type
 
 0.13    Tue Jun 23 05:46:33 PDT 2009
         - Add Test::Moose to build_requires for Fedora

Modified: branches/upstream/libmoosex-types-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/MANIFEST?rev=38832&op=diff
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/MANIFEST (original)
+++ branches/upstream/libmoosex-types-perl/current/MANIFEST Sat Jun 27 16:31:56 2009
@@ -33,6 +33,7 @@
 t/17_syntax_errors.t
 t/18_combined_libs.t
 t/19_typelib_with_role.t
+t/20_union_with_string_type.t
 t/lib/Combined.pm
 t/lib/DecoratorLibrary.pm
 t/lib/IntrospectTypeExports.pm

Modified: branches/upstream/libmoosex-types-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/META.yml?rev=38832&op=diff
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/META.yml (original)
+++ branches/upstream/libmoosex-types-perl/current/META.yml Sat Jun 27 16:31:56 2009
@@ -23,7 +23,7 @@
 provides:
   MooseX::Types:
     file: lib/MooseX/Types.pm
-    version: 0.13
+    version: 0.14
   MooseX::Types::Base:
     file: lib/MooseX/Types/Base.pm
   MooseX::Types::CheckedUtilExports:
@@ -51,4 +51,4 @@
   perl: 5.8.0
 resources:
   license: http://dev.perl.org/licenses/
-version: 0.13
+version: 0.14

Modified: branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types.pm?rev=38832&op=diff
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types.pm (original)
+++ branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types.pm Sat Jun 27 16:31:56 2009
@@ -20,7 +20,7 @@
 use namespace::clean -except => [qw( meta )];
 
 use 5.008;
-our $VERSION = '0.13';
+our $VERSION = '0.14';
 my $UndefMsg = q{Action for type '%s' not yet defined in library '%s'};
 
 =head1 SYNOPSIS

Modified: branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/TypeDecorator.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/TypeDecorator.pm?rev=38832&op=diff
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/TypeDecorator.pm (original)
+++ branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/TypeDecorator.pm Sat Jun 27 16:31:56 2009
@@ -23,8 +23,12 @@
         ## It's kind of ugly that we need to know about Union Types, but this
         ## is needed for syntax compatibility.  Maybe someday we'll all just do
         ## Or[Str,Str,Int]
-        
-        my @tc = grep {blessed $_} @_;
+
+	my @tc = map {
+	    blessed $_ ? $_ :
+	      Moose::Util::TypeConstraints::find_or_parse_type_constraint($_)
+	} @_;
+
         my $union = Moose::Meta::TypeConstraint::Union->new(type_constraints=>\@tc);
         return Moose::Util::TypeConstraints::register_type_constraint($union);
     },

Added: branches/upstream/libmoosex-types-perl/current/t/20_union_with_string_type.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/t/20_union_with_string_type.t?rev=38832&op=file
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/t/20_union_with_string_type.t (added)
+++ branches/upstream/libmoosex-types-perl/current/t/20_union_with_string_type.t Sat Jun 27 16:31:56 2009
@@ -1,0 +1,21 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+
+use Test::More tests => 1;
+
+my $exception;
+{
+    package TypeLib;
+
+    use MooseX::Types -declare => [qw( MyUnionType MyStr )];
+    use MooseX::Types::Moose qw(Str Item);
+
+    subtype MyUnionType, as Str|'Int';
+    subtype MyStr, as Str;
+
+    eval { coerce MyStr, from Item, via {"$_"} };
+    $exception = $@;
+}
+
+ok !$@, 'types are not mutated by union with a string type';




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