Subject: | Patch to pass 'gopher' URIs to LWP |
The attached patch introduces basic support for 'gopher' URIs,
harnessing LWP's stated support for such (5.800 here).
$req = HTTP::Request->new(GET => 'gopher://gopher.sn.no/');
- R.
diff -purdN IO-All-LWP-0.11/MANIFEST IO-All-LWP-0.11-gopher/MANIFEST
--- IO-All-LWP-0.11/MANIFEST Tue Jul 20 15:27:06 2004
+++ IO-All-LWP-0.11-gopher/MANIFEST Thu Oct 28 03:57:33 2004
@@ -9,6 +9,7 @@ inc/Module/Install/Win32.pm
inc/Module/Install/WriteAll.pm
iocp.pl
lib/IO/All/FTP.pm
+lib/IO/All/Gopher.pm
lib/IO/All/HTTP.pm
lib/IO/All/HTTPS.pm
lib/IO/All/LWP.pm
@@ -18,6 +19,7 @@ MANIFEST.bak
META.yml
README
t/ftp.t
+t/gopher.t
t/http.t
t/https.t
t/lwp.t
diff -purdN IO-All-LWP-0.11/lib/IO/All/Gopher.pm IO-All-LWP-0.11-gopher/lib/IO/All/Gopher.pm
--- IO-All-LWP-0.11/lib/IO/All/Gopher.pm Wed Dec 31 16:00:00 1969
+++ IO-All-LWP-0.11-gopher/lib/IO/All/Gopher.pm Thu Oct 28 03:58:13 2004
@@ -0,0 +1,60 @@
+package IO::All::Gopher;
+use strict;
+use warnings;
+our $VERSION = '0.11';
+use IO::All::LWP '-Base';
+
+const type => 'gopher';
+
+sub gopher { $self->lwp_init(__PACKAGE__, @_) }
+
+1;
+
+__END__
+
+=head1 NAME
+
+IO::All::Gopher - Extends IO::All to Gopher URLs
+
+=head1 SYNOPSIS
+
+ use IO::All;
+
+ io('gopher://example.org/pub/xyz') > io('xyz'); # GET to file
+
+=head1 DESCRIPTION
+
+This module extends IO::All for dealing with Gopher URLs.
+Note that you don't need to use it explicitly, as it is autoloaded by
+L<IO::All> whenever it sees something that looks like a Gopher URL.
+
+=head1 METHODS
+
+This is a subclass of L<IO::All::LWP>. The only new method is C<gopher>, which
+can be used to create a blank L<IO::All::Gopher> object; or it can also take an
+Gopher URL as a parameter. Note that in most cases it is simpler just to call
+io('gopher://example.com'), which calls the C<ftp> method automatically.
+
+=head1 OPERATOR OVERLOADING
+
+Read-only operators from IO::All may be used. < GETs a Gopher URL.
+
+=head1 SEE ALSO
+
+L<IO::All::LWP>, L<IO::All>, L<LWP>.
+
+=head1 AUTHORS
+
+Ivan Tubert-Brohman <itub@cpan.org> and
+Brian Ingerson <ingy@cpan.org>
+
+=head1 COPYRIGHT
+
+Copyright (c) 2004. Ivan Tubert-Brohman and Brian Ingerson. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+See L<http://www.perl.com/perl/misc/Artistic.html>
+
+=cut
diff -purdN IO-All-LWP-0.11/t/gopher.t IO-All-LWP-0.11-gopher/t/gopher.t
--- IO-All-LWP-0.11/t/gopher.t Wed Dec 31 16:00:00 1969
+++ IO-All-LWP-0.11-gopher/t/gopher.t Thu Oct 28 03:57:10 2004
@@ -0,0 +1,3 @@
+use Test::More tests => 1;
+
+use_ok('IO::All::Gopher');