in reply to LWP Credentials Login Problem to Download Zip Files
$ua->credentials( 'www.domain.com:80', '', 'user' => 'pass' );
Are you sure that middle parameter should be empty? If it doesn't match the "realm" configured in the server for that location, LWP won't know it is supposed to use these credentials to authorize itself.
In response to your wondering about the => arrow — it does nothing in your example. In fact, it's exactly the same as a comma. The difference is that this so-called "fat comma" lets you leave the left side unquoted, so you could say
$ua->credentials( 'foo:80', 'bar', user => 'pass' ); # needs no quotes
and get exactly the same result. There is no other difference, it's not magical in any way. It's just a bit of syntactic sugar to let you avoid quote noise when you want to. You can even use several of them in a row:
$ua->credentials( 'foo:80', bar => user => 'pass' );
But that quickly gets annoying to look at if you overdo it for no particular reason. It's nice to have when you want to make certain relationships stand out in the code, though. Sometimes, rarely, chaining several of them is actually sensible.
It's just one those little things in Perl.
Makeshifts last the longest.
|
|---|