144 lines
4.3 KiB
HTML
144 lines
4.3 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of URI::Heuristic</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>URI::Heuristic</H1>
|
|
Section: User Contributed Perl Documentation (3pm)<BR>Updated: 2020-02-08<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
URI::Heuristic - Expand URI using heuristics
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
|
|
|
|
|
|
|
|
<PRE>
|
|
use URI::Heuristic qw(uf_uristr);
|
|
$u = uf_uristr("perl"); # <A HREF="http://www.perl.com">http://www.perl.com</A>
|
|
$u = uf_uristr("<A HREF="http://www.sol.no">www.sol.no</A>/sol"); # <A HREF="http://www.sol.no/sol">http://www.sol.no/sol</A>
|
|
$u = uf_uristr("aas"); # <A HREF="http://www.aas.no">http://www.aas.no</A>
|
|
$u = uf_uristr("<A HREF="ftp://ftp.funet.fi">ftp.funet.fi</A>"); # <A HREF="ftp://ftp.funet.fi">ftp://ftp.funet.fi</A>
|
|
$u = uf_uristr("/etc/passwd"); # file:/etc/passwd
|
|
|
|
</PRE>
|
|
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
|
|
|
|
This module provides functions that expand strings into real absolute
|
|
URIs using some built-in heuristics. Strings that already represent
|
|
absolute URIs (i.e. that start with a <TT>"scheme:"</TT> part) are never modified
|
|
and are returned unchanged. The main use of these functions is to
|
|
allow abbreviated URIs similar to what many web browsers allow for URIs
|
|
typed in by the user.
|
|
<P>
|
|
|
|
The following functions are provided:
|
|
<DL COMPACT>
|
|
<DT id="1">uf_uristr($str)<DD>
|
|
|
|
|
|
Tries to make the argument string
|
|
into a proper absolute <FONT SIZE="-1">URI</FONT> string. The ``uf_'' prefix stands for ``User
|
|
Friendly''. Under MacOS, it assumes that any string with a common <FONT SIZE="-1">URL</FONT>
|
|
scheme (http, ftp, etc.) is a <FONT SIZE="-1">URL</FONT> rather than a local path. So don't name
|
|
your volumes after common <FONT SIZE="-1">URL</FONT> schemes and expect <B>uf_uristr()</B> to construct
|
|
valid file: <FONT SIZE="-1">URL</FONT>'s on those volumes for you, because it won't.
|
|
<DT id="2">uf_uri($str)<DD>
|
|
|
|
|
|
Works the same way as <B>uf_uristr()</B> but
|
|
returns a <TT>"URI"</TT> object.
|
|
</DL>
|
|
<A NAME="lbAE"> </A>
|
|
<H2>ENVIRONMENT</H2>
|
|
|
|
|
|
|
|
If the hostname portion of a <FONT SIZE="-1">URI</FONT> does not contain any dots, then
|
|
certain qualified guesses are made. These guesses are governed by
|
|
the following environment variables:
|
|
<DL COMPACT>
|
|
<DT id="3"><FONT SIZE="-1">COUNTRY</FONT><DD>
|
|
|
|
|
|
The two-letter country code (<FONT SIZE="-1">ISO 3166</FONT>) for your location. If
|
|
the domain name of your host ends with two letters, then it is taken
|
|
to be the default country. See also Locale::Country.
|
|
<DT id="4"><FONT SIZE="-1">HTTP_ACCEPT_LANGUAGE, LC_ALL, LANG</FONT><DD>
|
|
|
|
|
|
If <FONT SIZE="-1">COUNTRY</FONT> is not set, these standard environment variables are
|
|
examined and country (not language) information possibly found in them
|
|
is used as the default country.
|
|
<DT id="5"><FONT SIZE="-1">URL_GUESS_PATTERN</FONT><DD>
|
|
|
|
|
|
Contains a space-separated list of <FONT SIZE="-1">URL</FONT> patterns to try. The string
|
|
``<FONT SIZE="-1">ACME''</FONT> is for some reason used as a placeholder for the host name in
|
|
the <FONT SIZE="-1">URL</FONT> provided. Example:
|
|
|
|
|
|
<P>
|
|
|
|
|
|
|
|
|
|
<PRE>
|
|
URL_GUESS_PATTERN="<A HREF="http://www.ACME.no">www.ACME.no</A> <A HREF="http://www.ACME.se">www.ACME.se</A> <A HREF="http://www.ACME.com">www.ACME.com</A>"
|
|
export URL_GUESS_PATTERN
|
|
|
|
</PRE>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
|
|
|
|
Specifying <FONT SIZE="-1">URL_GUESS_PATTERN</FONT> disables any guessing rules based on
|
|
country. An empty <FONT SIZE="-1">URL_GUESS_PATTERN</FONT> disables any guessing that
|
|
involves host name lookups.
|
|
</DL>
|
|
<A NAME="lbAF"> </A>
|
|
<H2>COPYRIGHT</H2>
|
|
|
|
|
|
|
|
Copyright 1997-1998, Gisle Aas
|
|
<P>
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
modify it under the same terms as Perl itself.
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="6"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="7"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="8"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="9"><A HREF="#lbAE">ENVIRONMENT</A><DD>
|
|
<DT id="10"><A HREF="#lbAF">COPYRIGHT</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:59 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|