On 4/11/2004 5:25 PM, Rob Dixon wrote:
Randy W. Sims wrote:

The following code connects to a linksys router and resets the
connection. I can't seem to find the proper way to access the contents
of the HTML::Form::InputText object without accessing it's internal data
structure.

This is part of the expression in question:
my $status = $1 if $input->{value_name}

Anybody know a proper way to get this value?


Hi Randy.

You mean this stuff?


# Determine current connection status
my $form = $mech->form_number( 1 ) or die "Can't select form";
my $input = $form->find_input( 'pppoeAct' ) or die "Can't find input";
my $status = $1 if $input->{value_name} =~ /Status: 
(Connected|Connecting|Disconnected)/;


Have you looked at

perldoc HTML::Form

I think $input->value_names() will do what you want. Beware: it returns an array 
regardless
of context.

Thanks Rob. Unfortunately that didn't work. Dumper shows:


$VAR1 = \bless( {
                   'value_name' => 'áááStatus: Disconnected á',
                   'value' => '0',
                   'type' => 'hidden',
                   'name' => 'pppoeAct'
                 }, 'HTML::Form::TextInput' );

I did what I always do when I can't figure the documentation out: I read the code. It looks like there is no way to get at the value stored in 'value_name'. (bug?)

Anyway, I don't think any of this is going to work for me. I was testing this code on one type of Linksys DSL router, but the one I was going to implement on is a different model that generates the form dynamically with javascript. It doesn't apperat that WWW::Mechanize will work with that.

I think I'll just do what I should have done to begin with: Call my ISP and bitch at them for bumping my connection so often, especially since I paid extra for a static IP.

Thanks,
Randy.


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to