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
20 modified and are returned unchanged. The main use of these functions
21 is to allow abbreviated URIs similar to what many web browsers allow
22 for URIs 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
31 volumes after common URL schemes and expect uf_uristr() to
32 construct valid file: URL's on those volumes for you, because it
33 won't.
34
35 uf_uri($str)
36 Works the same way as uf_uristr() but returns a "URI" object.
37
39 If the hostname portion of a URI does not contain any dots, then
40 certain qualified guesses are made. These guesses are governed by the
41 following two environment variables:
42
43 COUNTRY The two-letter country code (ISO 3166) for your location. If
44 the domain name of your host ends with two letters, then it
45 is taken to be the default country. See also Locale::Country.
46
47 URL_GUESS_PATTERN
48 Contains a space-separated list of URL patterns to try. The
49 string "ACME" is for some reason used as a placeholder for
50 the host name in the URL provided. Example:
51
52 URL_GUESS_PATTERN="www.ACME.no www.ACME.se www.ACME.com"
53 export URL_GUESS_PATTERN
54
55 Specifying URL_GUESS_PATTERN disables any guessing rules
56 based on country. An empty URL_GUESS_PATTERN disables any
57 guessing that involves host name lookups.
58
60 Copyright 1997-1998, Gisle Aas
61
62 This library is free software; you can redistribute it and/or modify it
63 under the same terms as Perl itself.
64
65
66
67perl v5.10.1 2008-08-21 URI::Heuristic(3)