Subject: | PATCH: Detect common user errors |
Patch to detect if a silly user, like myself, called:
LWP::UserAgent->new( { agent => 'foo' } );
instead of the required:
LWP::UserAgent->new( agent => 'foo' );
It would also be nice if the options testing code, that checks to make
sure only valid options have been given, could be turned on with 'use
warnings' in my own code. But I couldn't figure out how to make that work.
Thanks!
Subject: | lwp-useragent-options.patch |
--- libwww-perl-5.807/lib/LWP/UserAgent.pm 2007-07-31 16:31:38.000000000 -0500
+++ libwww-perl-original/lib/LWP/UserAgent.pm 2006-06-05 03:36:37.000000000 -0500
@@ -32,12 +32,6 @@
sub new
{
- # Check for common user mistake calling
- # LWP::UserAgent->new( { agent => 'foo' } ) instead of
- # LWP::UserAgent->new( agent => 'foo' )
- Carp::croak("Options to LWP::UserAgent should be a hash, not reference")
- if ref($_[1]) eq 'HASH';
-
my($class, %cnf) = @_;
LWP::Debug::trace('()');