1Regexp::Common::URI::goUpsheerr(C3o)ntributed Perl DocumReengteaxtpi:o:nCommon::URI::gopher(3)
2
3
4
6 Regexp::Common::URI::gopher -- Returns a pattern for gopher URIs.
7
9 use Regexp::Common qw /URI/;
10
11 while (<>) {
12 /$RE{URI}{gopher}/ and print "Contains a gopher URI.\n";
13 }
14
16 $RE{URI}{gopher}{-notab}
17 Gopher URIs are poorly defined. Originally, RFC 1738 defined gopher
18 URIs, but they were later redefined in an internet draft. One that was
19 expired in June 1997.
20
21 The internet draft for gopher URIs defines them as follows:
22
23 "gopher:" "//" host [ ":" port ] "/" gopher-type selector
24 [ "%09" search [ "%09" gopherplus_string ]]
25
26 Unfortunally, a selector is defined in such a way that characters may
27 be escaped using the URI escape mechanism. This includes tabs, which
28 escaped are %09. Hence, the syntax cannot distinguish between a URI
29 that has both a selector and a search part, and an URI where the
30 selector includes an escaped tab. (The text of the draft forbids tabs
31 to be present in the selector though).
32
33 $RE{URI}{gopher} follows the defined syntax. To disallow escaped tabs
34 in the selector and search parts, use $RE{URI}{gopher}{-notab}.
35
36 There are other differences between the text and the given syntax.
37 According to the text, selector strings cannot have tabs, linefeeds or
38 carriage returns in them. The text also allows the entire gopher-path,
39 (the part after the slash following the hostport) to be empty; if this
40 is empty the slash may be omitted as well. However, this isn't
41 reflected in the syntax.
42
43 Under "{-keep}", the following are returned:
44
45 $1 The entire URI.
46
47 $2 The scheme.
48
49 $3 The host (name or address).
50
51 $4 The port (if any).
52
53 $5 The "gopher-path", the part after the / following the host and
54 port.
55
56 $6 The gopher-type.
57
58 $7 The selector. (When no "{-notab}" is used, this includes the search
59 and gopherplus_string, including the separating escaped tabs).
60
61 $8 The search, if given. (Only when "{-notab}" is given).
62
63 $9 The gopherplus_string, if given. (Only when "{-notab}" is given).
64
65 head1 REFERENCES
66
67 [RFC 1738]
68 Berners-Lee, Tim, Masinter, L., McCahill, M.: Uniform Resource
69 Locators (URL). December 1994.
70
71 [RFC 1808]
72 Fielding, R.: Relative Uniform Resource Locators (URL). June 1995.
73
74 [GOPHER URL]
75 Krishnan, Murali R., Casey, James: "A Gopher URL Format". Expired
76 Internet draft draft-murali-url-gopher. December 1996.
77
79 Regexp::Common::URI for other supported URIs.
80
82 Damian Conway (damian@conway.org)
83
85 This package is maintained by Abigail (regexp-common@abigail.be).
86
88 Bound to be plenty.
89
91 This software is Copyright (c) 2001 - 2009, Damian Conway and Abigail.
92
93 This module is free software, and maybe used under any of the following
94 licenses:
95
96 1) The Perl Artistic License. See the file COPYRIGHT.AL.
97 2) The Perl Artistic License 2.0. See the file COPYRIGHT.AL2.
98 3) The BSD Licence. See the file COPYRIGHT.BSD.
99 4) The MIT Licence. See the file COPYRIGHT.MIT.
100
101
102
103perl v5.12.0 2010-01-02 Regexp::Common::URI::gopher(3)