/usr/share/perl5/URI
NameSizeModeActions
file/-0755rm
urn/-0755rm
data.pm34170644editdlrm
Escape.pm70610644editdlrm
file.pm97610644editdlrm
ftp.pm10820644editdlrm
gopher.pm24540644editdlrm
Heuristic.pm65240644editdlrm
http.pm4510644editdlrm
https.pm1700644editdlrm
IRI.pm8200644editdlrm
ldap.pm29500644editdlrm
ldapi.pm4670644editdlrm
ldaps.pm1700644editdlrm
mailto.pm13020644editdlrm
mms.pm1510644editdlrm
news.pm14800644editdlrm
nntp.pm1530644editdlrm
pop.pm12330644editdlrm
QueryParam.pm48870644editdlrm
rlogin.pm1550644editdlrm
rsync.pm2330644editdlrm
rtsp.pm1510644editdlrm
rtspu.pm1520644editdlrm
sftp.pm1240644editdlrm
sip.pm17350644editdlrm
sips.pm1690644editdlrm
snews.pm1980644editdlrm
Split.pm23790644editdlrm
ssh.pm2010644editdlrm
telnet.pm1540644editdlrm
tn3270.pm1540644editdlrm
URL.pm54870644editdlrm
urn.pm22010644editdlrm
WithBase.pm38570644editdlrm
_foreign.pm1330644editdlrm
_generic.pm58480644editdlrm
_idna.pm21050644editdlrm
_ldap.pm32750644editdlrm
_login.pm2570644editdlrm
_punycode.pm56480644editdlrm
_query.pm25570644editdlrm
_segment.pm4420644editdlrm
_server.pm37500644editdlrm
_userpass.pm10600644editdlrm
Edit: /usr/share/perl5/URI/Split.pm (2379B)
package URI::Split; use strict; use warnings; our $VERSION = '1.73'; $VERSION = eval $VERSION; use Exporter 5.57 'import'; our @EXPORT_OK = qw(uri_split uri_join); use URI::Escape (); sub uri_split { return $_[0] =~ m,(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?,; } sub uri_join { my($scheme, $auth, $path, $query, $frag) = @_; my $uri = defined($scheme) ? "$scheme:" : ""; $path = "" unless defined $path; if (defined $auth) { $auth =~ s,([/?\#]), URI::Escape::escape_char($1),eg; $uri .= "//$auth"; $path = "/$path" if length($path) && $path !~ m,^/,; } elsif ($path =~ m,^//,) { $uri .= "//"; # XXX force empty auth } unless (length $uri) { $path =~ s,(:), URI::Escape::escape_char($1),e while $path =~ m,^[^:/?\#]+:,; } $path =~ s,([?\#]), URI::Escape::escape_char($1),eg; $uri .= $path; if (defined $query) { $query =~ s,(\#), URI::Escape::escape_char($1),eg; $uri .= "?$query"; } $uri .= "#$frag" if defined $frag; $uri; } 1; __END__ =head1 NAME URI::Split - Parse and compose URI strings =head1 SYNOPSIS use URI::Split qw(uri_split uri_join); ($scheme, $auth, $path, $query, $frag) = uri_split($uri); $uri = uri_join($scheme, $auth, $path, $query, $frag); =head1 DESCRIPTION Provides functions to parse and compose URI strings. The following functions are provided: =over =item ($scheme, $auth, $path, $query, $frag) = uri_split($uri) Breaks up a URI string into its component parts. An C value is returned for those parts that are not present. The $path part is always present (but can be the empty string) and is thus never returned as C. No sensible value is returned if this function is called in a scalar context. =item $uri = uri_join($scheme, $auth, $path, $query, $frag) Puts together a URI string from its parts. Missing parts are signaled by passing C for the corresponding argument. Minimal escaping is applied to parts that contain reserved chars that would confuse a parser. For instance, any occurrence of '?' or '#' in $path is always escaped, as it would otherwise be parsed back as a query or fragment. =back =head1 SEE ALSO L, L =head1 COPYRIGHT Copyright 2003, Gisle Aas This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut