This would be handy to me. Relying on a particular name is probably
about as fragile as relying on the order of forms, but it feels nicer.
Jason
--- Form.pm.orig Wed Jun 7 12:33:18 2000
+++ Form.pm Wed Jun 7 12:36:54 2000
@@ -64,6 +64,7 @@
$self->{method} = uc(shift || "GET");
$self->{action} = shift || Carp::croak("No action defined");
$self->{enctype} = shift || "application/x-www-form-urlencoded";
+ $self->{name} = shift || undef;
$self->{inputs} = [@_];
$self;
}
@@ -94,12 +95,14 @@
while (my $t = $p->get_tag) {
my($tag,$attr) = @$t;
if ($tag eq "form") {
+ my $name = $attr->{'name'};
my $action = $attr->{'action'};
$action = "" unless defined $action;
$action = URI->new_abs($action, $base_uri);
$f = $class->new($attr->{'method'},
$action,
- $attr->{'enctype'});
+ $attr->{'enctype'},
+ $name);
push(@forms, $f);
while (my $t = $p->get_tag) {
my($tag, $attr) = @$t;
@@ -172,14 +175,16 @@
=item $form->enctype( [$new] )
+=item $form->name( [$new] )
+
These method can be used to get/set the corresponding attribute of the
form.
=cut
BEGIN {
- # Set up some accesor
- for (qw(method action enctype)) {
+ # Set up some accessor
+ for (qw(method action enctype name)) {
my $m = $_;
no strict 'refs';
*{$m} = sub {