Subject: | Use submit_form() w/o args to submit current form |
Another step in the direction of cleaner scripts. No need to submit_form by name and number after we selected that very form for fields updating.
--- Logger.pm.orig Mon Mar 1 08:31:03 2004
+++ lib/HTTP/Recorder/Logger.pm Wed Jun 16 20:43:26 2004
@@ -49,7 +49,7 @@
sub Log {
my $self = shift;
my $function = shift;
- my $args = shift;
+ my $args = shift || '';
my $line = $self->{agentname} . "->$function($args);\n";
@@ -127,9 +127,7 @@
$self->SetField(name => $field,
value => $args{fields}->{$field});
}
- $self->Submit(name => $args{name},
- number => $args{number},
- button_name => $args{button_name},
+ $self->Submit(button_name => $args{button_name},
button_value => $args{button_value},
button_number => $args{button_number},
);
@@ -171,8 +169,10 @@
# Don't add this until WWW::Mechanize supports it
if ($args{name}) {
$self->Log("submit_form", "form_name => \"$args{name}\"");
- } else {
+ } elsif ($args{number}) {
$self->Log("submit_form", "form_number => \"$args{number}\"");
+ } else {
+ $self->Log("submit_form");
}
}