Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the WWW-Mechanize CPAN distribution.

Report information
The Basics
Id: 1517
Status: resolved
Priority: 0/
Queue: WWW-Mechanize

People
Owner: Nobody in particular
Requestors: spoon [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Date: Mon, 16 Sep 2002 11:38:44 +1000
From: Iain Truskett <spoon [...] cpan.org>
To: www-mechanize [...] rt.cpan.org
Subject: a subclass
package Subclass; use base 'WWW::Mechanize'; use HTTP::Cookies; sub new { my $class = shift; my $self = $class->SUPER::new(@_); $self->cookie_jar(HTTP::Cookies->new( file => 'cookies.txt', autosave => 1, ignore_discard => 1, )); return bless $self, $class; } sub field { my ($self, $name, $value, $number) = @_; $number ||= 1; my $form = $self->{form}; if ($number > 1) { $form->find_input($name, $number)->value( (defined $value ? ($value) : ()) ); } else { $form->value($name, (defined $value ? ($value) : ())); } } 1;
Thanks for the helper code. xoa