On Fri, Aug 08, 2003 at 10:49:39PM -0700, Gupta, Sharad wrote:
> sub Foo::INC {
> my ($self,$filename) = @_;
> my @paths = "http:/me.com";
> my @urls = map{$_ . "/" . [EMAIL PROTECTED];
> my $ua = LWP::UserAgent->new();
> foreach my $url(@urls) {
> my $request = HTTP::Request->new($url);
> my $response = $ua->request($request);
> if($response->is_success()) {
> return $response->content();
You're supposed to return a filehandle:
open my $fh, '<', \($response->content);
return $fh;
> }
> }
> return undef;
> }
I'd also suggest caching the downloaded modules and letting
the constructor take a list of base urls.
And by the way, does anybody know offhand why the subroutine
name needs to be fully-qualified in the declaration? I haven't
really looked at this feature, but it seems like an strange
requirement.
--
Steve
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]