-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
URI->new('foo', 'http') doesn't set the scheme #88
Comments
I can't actually find a tag from the last 10 years where this works. It looks like it's creating the right class based on the supplied scheme, but #!perl
use strict;
use warnings;
use Test::More tests => 4;
use URI;
my $uri = URI->new('example', 'example-scheme');
is $uri->scheme, 'example-scheme';
is ref $uri, 'URI::_foreign', 'is URI::_foreign';
# Also test the synopsis:
my $u2 = URI->new("foo", "http");
is $u2->scheme, 'http';
is ref $u2, 'URI::http', 'is URI::http'; In unless (@_) {
return undef unless $$self =~ /^($scheme_re):/o;
return $1;
}
Not quite sure what the correct fix is, but that's just from a quick look. |
It seems to be because of $str = "$scheme:$str" unless $str =~ /^$scheme_re:/o ||
$class->_no_scheme_ok; in URI::_init(). Removing the "no_scheme_ok" check breaks lots of other tests, though. |
The two-argument constructor setting the
scheme
part of an URL doesn't work (anymore?) as shown in the synopsis, see the attached test.Due to the deep inheritance tree, I didn't find out where the scheme information gets lost, but either the synopsis should be amended or specifying the scheme in the constructor should be made to work again.
Thanks!
uri-scheme.t.txt
The text was updated successfully, but these errors were encountered: