Permalink
Browse files

removed unnecessary building of $error. This closes ticket #13.

  • Loading branch information...
1 parent 589c02d commit 1f71e860648388d61563411ec871492117ca9349 @petdance committed Apr 13, 2012
Showing with 2 additions and 28 deletions.
  1. +2 −28 Mechanize.pm
View
@@ -307,20 +307,7 @@ sub submit_form_ok {
# return from submit_form() is an HTTP::Response or undef
my $response = $self->submit_form( %{$parms} );
- my $ok;
- my $error;
- if ( !$response ) {
- $error = 'No matching form found';
- }
- else {
- if ( $response->is_success ) {
- $ok = 1;
- }
- else {
- $error = $response->as_string;
- }
- }
-
+ my $ok = $response && $response->is_success;
$ok = $self->_maybe_lint( $ok, $desc );
return $ok;
@@ -365,20 +352,7 @@ sub follow_link_ok {
# return from follow_link() is an HTTP::Response or undef
my $response = $self->follow_link( %{$parms} );
- my $ok;
- my $error;
- if ( !$response ) {
- $error = 'No matching link found';
- }
- else {
- if ( $response->is_success ) {
- $ok = 1;
- }
- else {
- $error = $response->as_string;
- }
- }
-
+ my $ok = $response && $response->is_success;
$ok = $self->_maybe_lint( $ok, $desc );
return $ok;

0 comments on commit 1f71e86

Please sign in to comment.