-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document current best practices #314
Conversation
I'm 👍 on this idea |
lib/LWP/UserAgent.pm
Outdated
die $response->status_line; | ||
} | ||
my $jar = HTTP::CookieJar::LWP->new; | ||
my $agent = LWP::UserAgent->new( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/$agent/$ua/
Also, I think we should use the same variable name for LWP::UserAgent objects in this document.
So why don't you use $ua
in "BEST PRACTICES" section too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I've fixed all of those cases now. This was partly a copy/paste from WWW::Mechanize
, which is where $agent
came from. Although, looking more closely at that, it should probably have been $mech
in the WWW::Mechanize
docs, since that's what everything else there uses.
lib/LWP/UserAgent.pm
Outdated
my $response = $ua->get('http://example.com'); | ||
|
||
if ($response->is_success) { | ||
print $response->decoded_content; # or whatever |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can do without the # or whatever
comment
I usually use the ...
to indicate arbitrary code that can be anything before or after ... or here, in the middle
But having the decoded_content
is a good example too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, I'm not sure why someone cough cough ever put that in there. It reads oddly passive aggressive. /me hides
6efed87
to
e40a71b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
No description provided.