The URI
constructor creates an object instance specific to the scheme of the data passed to it. For http data, that is URI::http
. However, if it's unable to determine a scheme, the final fall back is of class URI::_foreign
.
Each of these subclasses have different abilities and features. As you've observed, the base class _foreign
does not have an implementation of query_form
.
So our question why is your data not being interpreted as http
? I also think, like ikegami, that what you posted is not representative of the $uri
you actually had.
Here is a script that shows how URI
will interpret data specific to the scheme:
use strict;
use warnings;
use URI;
while (<DATA>) {
chomp;
my $u = URI->new($_);
printf "%-13s - %s\n", ref($u), $u;
}
__DATA__
http://www.asdf.com
http://www.asdf.com/morestuff
http://////too_many_slashes_still_ok
ftp://ftp.asdf.com/
gopher://oldtimey.com/
unknown://www.asdf.com/
outputs:
URI::http - http://www.asdf.com
URI::http - http://www.asdf.com/morestuff
URI::http - http://////too_many_slashes_still_ok
URI::ftp - ftp://ftp.asdf.com/
URI::gopher - gopher://oldtimey.com/
URI::_foreign - unknown://www.asdf.com/