NAME
Apache::URI - URI component parsing and unparsing
SYNOPSIS
use Apache::URI ();
my $uri = $r->parseduri;
my $uri = Apache::URI->parse($r, "http://perl.apache.org/");
DESCRIPTION
This module provides an interface to the Apache utiluri module and the uricomponents structure. MMEETTHHOODDSS Apache::parseduri Apache will have already parsed the requested uri components, which can be obtained via the parseduri method defined in the Apacheclass. This method returns an object blessed into the Apache::URI
class.my $uri = $r->parseduri;
parse This method will parse a URI string into uri components which arestashed in the Apache::URI object it returns.
my $uri = Apache::URI->parse($r, "http://www.foo.com/path/file.html?query+string");
This method is considerably faster than using URI::URL: timethese(5000, {C => sub { Apache::URI->parse($r, $testuri) },
Perl => sub { URI::URL->new($testuri) },
}); Benchmark: timing 5000 iterations of C, Perl... C: 1 secs ( 0.62 usr 0.04 sys = 0.66 cpu) Perl: 6 secs ( 6.21 usr 0.08 sys = 6.29 cpu) unparseThis method will join the uri components back into a string ver-
sion.my $string = $uri->unparse;
schememy $scheme = $uri->scheme;
hostinfomy $hostinfo = $uri->hostinfo;
usermy $user = $uri->user;
passwordmy $password = $uri->password;
hostnamemy $hostname = $uri->hostname;
portmy $port = $uri->port;
pathmy $path = $uri->path;
rpath Returns the path minus pathinfo.my $path = $uri->rpath;
querymy $query = $uri->query;
fragmentmy $fragment = $uri->fragment;
AUTHOR Doug MacEachernSEE ALSO
perl(1).perl v5.8.6 2000-03-30 URI(3)