Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: MORIYA [...] cpan.org
Cc:
AdminCc:

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



Subject: [PATCH] Fixing coercion from HashRef
Hello, the attached patch tries to fix that coercion from a hash reference did not return an URI object. Thank you for your time and consideration. Regards, -- MORIYA Masaki, alias Gardejo
Subject: fix-coerce-from-hashref.patch
diff --git a/lib/MooseX/Types/URI.pm b/lib/MooseX/Types/URI.pm index 7507b63..ac338ae 100644 --- a/lib/MooseX/Types/URI.pm +++ b/lib/MooseX/Types/URI.pm @@ -13,7 +13,7 @@ use URI; use URI::file; use URI::data; use URI::WithBase; -use URI::FromHash qw(uri); +use URI::FromHash qw(uri_object); use Moose::Util::TypeConstraints; @@ -48,7 +48,7 @@ coerce( Uri, 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(%$_) }, + from HashRef , via { uri_object(%$_) }, ); class_type FileUri, { class => "URI::file", parent => $uri }; diff --git a/t/basic.t b/t/basic.t index 35ceb28..5ef7c79 100644 --- a/t/basic.t +++ b/t/basic.t @@ -90,6 +90,10 @@ isa_ok( to_Uri("foo"), "URI" ); is( to_Uri("foo")->path, "foo", "URI" ); is( to_Uri("foo")->scheme, undef, "URI" ); +isa_ok( to_Uri({path => 'foo'}), "URI" ); +is( to_Uri({path => 'foo'})->path, "foo", "URI from HashRef" ); +is( to_Uri({path => 'foo'})->scheme, undef, "URI from HashRef" ); + isa_ok( to_FileUri("foo"), "URI::file" ); is( to_FileUri("foo")->file, "foo", "filename" );
Subject: I've pull-requested on GitHub the fix
Hello, I'm sorry that I didn't notice that there is the repository of the module in GitHub (because I've watched only Makefile.PL and META.yml). So, I've pull-requested on GitHub the fix. https://github.com/rafl/moosex-types-uri/pull/1 Please consider the fix, if it suits your convenience. Regards, -- MORIYA Masaki, alias Gardejo
thanks, releasing in 0.04