B
buildmorelines
I would like to know how to merge the cookies line into creation of
request variable/object?. The code works fine, but for visual clarity
it would be nice to merge the cookies line into some other line if
possible.(I love Perl because it still has a good old thing called
procedural programing, OO stuff is chinese to me).
my $ua = new LWP::UserAgent;
my $request = HTTP::Request->new('GET', $my_url);
$request->header('Cookie' => 'foo_likes_it=hi');
my $response = $ua->request($request);
print $response->content;
Also, less importantly (remember TMTOWTDI), did I do the right thing
by adding a static cookies header to the HTTP request? or should the
professional way be through the cookie_jar of LWP::UserAgent, and then
to HTTP::Cookies, or play with HTTP::Headers?
The cookie is always static, and never needs to be changed. There is
no need to "save" or "capture" any cookies from the server.
request variable/object?. The code works fine, but for visual clarity
it would be nice to merge the cookies line into some other line if
possible.(I love Perl because it still has a good old thing called
procedural programing, OO stuff is chinese to me).
my $ua = new LWP::UserAgent;
my $request = HTTP::Request->new('GET', $my_url);
$request->header('Cookie' => 'foo_likes_it=hi');
my $response = $ua->request($request);
print $response->content;
Also, less importantly (remember TMTOWTDI), did I do the right thing
by adding a static cookies header to the HTTP request? or should the
professional way be through the cookie_jar of LWP::UserAgent, and then
to HTTP::Cookies, or play with HTTP::Headers?
The cookie is always static, and never needs to be changed. There is
no need to "save" or "capture" any cookies from the server.