Skip Menu |

This queue is for tickets about the MooseX-Types-URI CPAN distribution.

Report information
The Basics
Id: 46393
Status: resolved
Priority: 0/
Queue: MooseX-Types-URI

People
Owner: Nobody in particular
Requestors: daniel [...] rimspace.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: [PATCH 2/2] Coerce from additional MooseX::Types::Path::Class types.
Date: Wed, 27 May 2009 11:33:32 +1000
To: bug-MooseX-Types-URI [...] rt.cpan.org
From: Daniel Pittman <daniel [...] rimspace.net>
We now coerce from the File and Dir named types, as well as the classes. While this probably makes little practical difference it does respect part of the upstream documented API. --- lib/MooseX/Types/URI.pm | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/lib/MooseX/Types/URI.pm b/lib/MooseX/Types/URI.pm index 3cb502d..1e2403c 100755 --- a/lib/MooseX/Types/URI.pm +++ b/lib/MooseX/Types/URI.pm @@ -18,7 +18,7 @@ use URI::FromHash qw(uri); use Moose::Util::TypeConstraints; use MooseX::Types::Moose qw{Str ScalarRef HashRef}; -use MooseX::Types::Path::Class; +use MooseX::Types::Path::Class qw{File Dir}; use namespace::clean; @@ -45,6 +45,8 @@ coerce( Uri, from Str , via { URI->new($_) }, from "Path::Class::File" , via { URI::file->new($_) }, from "Path::Class::Dir" , via { URI::file->new($_) }, + from File , via { URI::file->new($_) }, + from Dir , via { URI::file->new($_) }, from ScalarRef , via { my $u = URI->new("data:"); $u->data($$_); $u }, from HashRef , via { uri(%$_) }, ); @@ -53,6 +55,8 @@ class_type FileUri, { class => "URI::file", parent => $uri }; coerce( FileUri, from Str , via { URI::file->new($_) }, + from File , via { URI::file->new($_) }, + from Dir , via { URI::file->new($_) }, from "Path::Class::File" , via { URI::file->new($_) }, from "Path::Class::Dir" , via { URI::file->new($_) }, ); -- 1.6.3.1