Subject: | [PATCH 1/2] Use MooseX::Types type declarators in the type coercions. |
Date: | Wed, 27 May 2009 11:33:31 +1000 |
To: | bug-MooseX-Types-URI [...] rt.cpan.org |
From: | Daniel Pittman <daniel [...] rimspace.net> |
This eliminates a warning from MooseX::Types, and brings this module in line
with the documented API.
---
lib/MooseX/Types/URI.pm | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
mode change 100644 => 100755 lib/MooseX/Types/URI.pm
diff --git a/lib/MooseX/Types/URI.pm b/lib/MooseX/Types/URI.pm
old mode 100644
new mode 100755
index 99ac126..3cb502d
--- a/lib/MooseX/Types/URI.pm
+++ b/lib/MooseX/Types/URI.pm
@@ -17,6 +17,7 @@ use URI::FromHash qw(uri);
use Moose::Util::TypeConstraints;
+use MooseX::Types::Moose qw{Str ScalarRef HashRef};
use MooseX::Types::Path::Class;
use namespace::clean;
@@ -41,30 +42,29 @@ my $uri = Moose::Meta::TypeConstraint->new(
register_type_constraint($uri);
coerce( Uri,
- from Str => via { URI->new($_) },
- from "Path::Class::File" => via { URI::file->new($_) },
- from "Path::Class::Dir" => via { URI::file->new($_) },
- from ScalarRef => via { my $u = URI->new("data:"); $u->data($$_); $u },
- from HashRef => via { uri(%$_) },
+ from Str , via { URI->new($_) },
+ from "Path::Class::File" , via { URI::file->new($_) },
+ from "Path::Class::Dir" , via { URI::file->new($_) },
+ from ScalarRef , via { my $u = URI->new("data:"); $u->data($$_); $u },
+ from HashRef , via { uri(%$_) },
);
class_type FileUri, { class => "URI::file", parent => $uri };
coerce( FileUri,
- from Str => via { URI::file->new($_) },
- from "Path::Class::File" => via { URI::file->new($_) },
- from "Path::Class::Dir" => via { URI::file->new($_) },
+ from Str , via { URI::file->new($_) },
+ from "Path::Class::File" , via { URI::file->new($_) },
+ from "Path::Class::Dir" , via { URI::file->new($_) },
);
class_type DataUri, { class => "URI::data" };
coerce( DataUri,
- from Str => via { my $u = URI->new("data:"); $u->data($_); $u },
- from ScalarRef => via { my $u = URI->new("data:"); $u->data($$_); $u },
+ from Str , via { my $u = URI->new("data:"); $u->data($_); $u },
+ from ScalarRef , via { my $u = URI->new("data:"); $u->data($$_); $u },
);
-__PACKAGE__
-
+1;
__END__
=pod
--
1.6.3.1