>> You're supposed to return a filehandle:

Yep. But i am using the temp files for doing that. And i would love to get rid of the 
temp files altogether.

open my $fh, '<', \($response->content);

Seems like we are opening a filehandle to a string. Very difficult to convince my 
sysadmin to get to 5.8 soon. Any other suggestions to get rid of those temp files. I 
hate them.
 

>> I'd also suggest caching the downloaded modules

Give me a little of your magical sight -:)  


 >> letting the constructor take a list of base urls.
Yes, thats what i would be doing in production.


>>And by the way, does anybody know offhand why the subroutine 
>>name needs to be fully-qualified in the declaration?  

Require says:

If the hook is an object, it must provide an INC method, that will be called as above, 
the first parameter being the object itself. (Note that you must fully qualify the 
sub's name, as it is always forced into package main.)


Thanx,
-Sharad 

-----Original Message-----
From: Steve Grazzini [mailto:[EMAIL PROTECTED]
Sent: Saturday, August 09, 2003 1:51 PM
To: Gupta, Sharad
Cc: [EMAIL PROTECTED]
Subject: Re: Ok I am tired


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

Reply via email to