LWP::Protocol::virtual - Protocol to locate resources on groups of sites


LWP-Protocol-virtual documentation Contained in the LWP-Protocol-virtual distribution.

Index


Code Index:

NAME

Top

LWP::Protocol::virtual - Protocol to locate resources on groups of sites

VERSION

Top

Version 0.02

SYNOPSIS

Top

 #
## From shell, not perl.
cpan URI::virtual
echo 'CPAN http://cpan.mirror.com/pub/CPAN' > ~/.lwp_virt
GET virtual://CPAN/some/path/some-path-1.0.tgz > some-path-1.0.tgz
perl -MCPAN -e '
	my $CPAN = CPAN->new();
	CPAN::Config->load($CPAN);
	$CPAN::Config->{urllist} = [ qw(virtual://CPAN/) ];
	CPAN::Config->commit("MyConfig.pm");
'
## Move MyConfig to somewhere CPAN will find it.




FUNCTIONS

Top

request

This processes a request, by calling $uri->resolve on the URI object (which one would suspect is an instalnce of URI::virtual, and therefore supports it) and returning a redirect to the uri returned. Any URI subclass which satisfies the conditions:

	$uri->can("resolve")->()->isa("URI")
	ref $uri->can("path") eq 'CODE'

will be acceptable. How you would tell LWP to use this Protocol for another scheme is anybody's guess.

see URI::virtual.

AUTHOR

Top

Rich Paul, <cpan@rich-paul.net> Mail to this address bounces, but you'll think of something. It's a poor man's Turing Test.

BUGS

Top

Please report any bugs or feature requests to bug-lwp-protocol-virtual@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=LWP-Protocol-virtual. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

ACKNOWLEDGEMENTS

Top

The guys who wrote LWP. Nice job!

COPYRIGHT & LICENSE

Top


LWP-Protocol-virtual documentation Contained in the LWP-Protocol-virtual distribution.
# vim: ts=4 sw=4
package LWP::Protocol::virtual;

use warnings;
use strict;

our $VERSION = '0.02';
use LWP::Protocol;
use HTTP::Status qw( RC_BAD_REQUEST RC_FOUND       );
use Carp qw(confess);
use Data::Dumper;
use strict;

our (@ISA) = qw(LWP::Protocol);


sub request {
	my ($self, $req, $res) = (shift,shift);
	$res = HTTP::Response->new(RC_FOUND);
	$res->header("Location" => $req->uri()->resolve());
	return $res;
};
1;

1; # End of LWP::Protocol::virtual