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