1URI::Heuristic(3) User Contributed Perl Documentation URI::Heuristic(3)
2
3
4
6 URI::Heuristic - Expand URI using heuristics
7
9 use URI::Heuristic qw(uf_uristr);
10 $u = uf_uristr("perl"); # http://www.perl.com
11 $u = uf_uristr("www.sol.no/sol"); # http://www.sol.no/sol
12 $u = uf_uristr("aas"); # http://www.aas.no
13 $u = uf_uristr("ftp.funet.fi"); # ftp://ftp.funet.fi
14 $u = uf_uristr("/etc/passwd"); # file:/etc/passwd
15
17 This module provides functions that expand strings into real absolute
18 URIs using some built-in heuristics. Strings that already represent
19 absolute URIs (i.e. that start with a "scheme:" part) are never modi‐
20 fied and are returned unchanged. The main use of these functions is to
21 allow abbreviated URIs similar to what many web browsers allow for URIs
22 typed in by the user.
23
24 The following functions are provided:
25
26 uf_uristr($str)
27 Tries to make the argument string into a proper absolute URI
28 string. The "uf_" prefix stands for "User Friendly". Under MacOS,
29 it assumes that any string with a common URL scheme (http, ftp,
30 etc.) is a URL rather than a local path. So don't name your vol‐
31 umes after common URL schemes and expect uf_uristr() to construct
32 valid file: URL's on those volumes for you, because it won't.
33
34 uf_uri($str)
35 Works the same way as uf_uristr() but returns a "URI" object.
36
38 If the hostname portion of a URI does not contain any dots, then cer‐
39 tain qualified guesses are made. These guesses are governed by the
40 following two environment variables:
41
42 COUNTRY The two-letter country code (ISO 3166) for your location. If
43 the domain name of your host ends with two letters, then it
44 is taken to be the default country. See also Locale::Country.
45
46 URL_GUESS_PATTERN
47 Contains a space-separated list of URL patterns to try. The
48 string "ACME" is for some reason used as a placeholder for
49 the host name in the URL provided. Example:
50
51 URL_GUESS_PATTERN="www.ACME.no www.ACME.se www.ACME.com"
52 export URL_GUESS_PATTERN
53
54 Specifying URL_GUESS_PATTERN disables any guessing rules
55 based on country. An empty URL_GUESS_PATTERN disables any
56 guessing that involves host name lookups.
57
59 Copyright 1997-1998, Gisle Aas
60
61 This library is free software; you can redistribute it and/or modify it
62 under the same terms as Perl itself.
63
64
65
66perl v5.8.8 2004-01-14 URI::Heuristic(3)