LWP::UserAgent
am 09.05.2005 22:49:44 von cternaiUsing the LWP::UserAgents Html::Header Object doesnt work for me.
I'am not sure why.
I used it the following ways:
$ua->default_header('Referer' => "http://www.domain.de");
$ua->default_headers->push_header('Referer' => "http://www.domain.de");
used it like a html::header
$ua->default_headers->referer("http://www.domain.de");
It returns:
Can't locate object method "default_headers" via package
"LWP::UserAgent" (perhaps you forgot to load "LWP::UserAgent"?) at
../myperl.pl line 150.
No, I included LWP.
use LWP;
I already tried with
use LWP::UserAgent;
No changes.
This is what CPAN says:
$ua->default_headers( $headers_obj )
Get/set the headers object that will provide default header values for
any requests sent. By default this will be an empty HTTP::Headers
object. Example:
$ua->default_headers->push_header('Accept-Language' => "no, en");
$ua->default_header( $field )
$ua->default_header( $field => $value )
This is just a short-cut for $ua->default_headers->header( $field =>
$value ). Example:
$ua->default_header('Accept-Language' => "no, en");
thx
similian