in reply to Re^5: javascript login
in thread javascript login

for all 4 lines it gives an error global symbol $userid requires explicit package name global symbol $password requires explicit package name global symbol $userid requires explicit package name global symbol $password requires explicit package name

$userid = "usr"; $password = "passwd"; userid => "$userid", password => "$password"

Replies are listed 'Best First'.
Re^7: javascript login
by aitap (Curate) on Aug 17, 2012 at 18:58 UTC

    it gives an error global symbol $userid requires explicit package name
    Perhaps this is because you use strict and these variables are not declared?

    Sorry if my advice was wrong.
      I put strict off and it gives no errors, then i ran it and it gave line 6 unknown agent 'firefox' and line 1900 of mechanize.pm says there is no form numbered 2, How can i resolve the first error and where does it say the form of html? sorry I am slow in this but I appreciate your help very much:)
      my $mech = WWW::Mechanize->new(); $mech->agent_alias( 'Firefox' ); $userid = "usr"; $password = "password"; $mech->get( "https://login.binck.nl/klanten/Login.aspx?ReturnUrl=%2fkl +anten%2fdefault.aspx" ); $mech->submit_form( form_number => 2, fields => { userid => "$userid", password => "$password" }, button => "btnSignon" );

        I put strict off and it gives no errors,
        It is recommended to put it back on and declare variables properly.

        then i ran it and it gave line 6 unknown agent 'firefox'
        This is because there is no agent alias called "Firefox". Use known_agent_aliases() to get available names, for example:
        $ perl -MWWW::Mechanize -E'say join ", ",WWW::Mechanize::known_agent_a +liases' Linux Konqueror, Linux Mozilla, Mac Mozilla, Mac Safari, Windows IE 6, + Windows Mozilla

        and line 1900 of mechanize.pm says there is no form numbered 2
        Try using Data::Dumper and forms() method to get the list of forms available for WWW::Mechanize.

        Sorry if my advice was wrong.