Bio-Das
view release on metacpan or search on metacpan
# The callback routine used below for authentication must accept three arguments:
# the fetcher object, the realm for authentication, and the iteration
# we are on. A return of undef means that we should stop trying this connection (e.g. cancel button
# pressed, or x number of iterations tried), otherwise a two element array (not a reference to an array)
# should be returned with the username and password in that order.
# I assume if you've called autheniticate, it's because you've gotten a 401 error.
# Otherwise this does not make sense.
# There is also no caching of authentication done. I suggest the callback do this, so
# the user isn't asked 20 times for the same name and password.
sub authenticate($$$){
my ($self, $fetcher) = @_;
my $callback = $self->auth_callback;
return undef unless defined $callback;
$self->{auth_iter} = {} if not defined $self->{auth_iter};
my ($realm) = $fetcher->error =~ /^\S+\s+'(.*)'/;
return if $self->{auth_iter}->{$realm} < 0; # Sign that we've given up, don't try again
( run in 0.559 second using v1.01-cache-2.11-cpan-65fba6d93b7 )