Hi Martin, Great, that's because so far i'm kind of stuck :(
After browsing through some simple tutorial this is what i came up with.

use WWW::Mechanize; my $mech = WWW::Mechanize->new( autocheck => 1 ); # connect to the adsl setting page $mech->get( "http://192.168.1.1" ); # connect with user name and password my $r = $mech->submit_form( form_number => 2, fields => 'uiViewUserName' => "admin", 'uiViewPassword' => "admin"); die "Couldn't submit form" unless $r->ls_success; # print the content of the admin page so that i know i'm in #print $mech->content;

I've try other methods like $mech->field, $mech->set_visible but i always get this error back.
Error GETing http://192.168.1.1: Can't connect to 192.168.1.1:80 (connect: Unknown error) at C:\Documents and Settings\Mela\Desktop\simple.pl line 4
and included is the html content for that admin page that i get by using $mech->get( "http://192.168.1.1", ":content_file" => "C:\output.txt" );
<html> <head> <title>&gt;Log In</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 +"> <style type="text/css"> body { margin: 0px 0px; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 9pt; font-weight: normal; text-decoration: none; color: #2A2A2A; } p, td { } .header { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 8pt; font-weight: bold; } .inputButton { border-color: #505050; border-width: 1px; background-color: #2A7EC7; font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: Bold; font-size: 11px; color: #FFFFFF; width: 61px; height: 18px; vertical-align: middle; margin: 4px; } </style> <script language="JavaScript"> var teststring = ""+"<? echo webcm ?>"; function webCMEnabled() { return (document.getElementById("uiPostTestWebCM").value == "webcm +"); } function autoLogin() { if (!webCMEnabled()) { location.href = "/cgi-bin/webcm"; } else { var authenable = "<? query security:settings/authenable ?>"; if (authenable == "0") { document.getElementById("uiPostErrPage").value = document. +getElementById("uiPostGetPage").value; document.getElementById("uiPostForm").submit(); } else { document.getElementById("loginPageTable").style.display = +''; document.getElementById("uiViewUserName").value=document +.getElementById("uiPostUserName").value; document.getElementById("uiViewUserName").focus(); } } } function uiDoOnLoad() { autoLogin(); /*document.getElementById("uiViewUserName").value=document.getElemen +tById("uiPostUserName").value; document.getElementById("uiViewUserName").focus();*/ //top.resizeTo(1024,780); if(document.getElementById("uiPostErrorState").value=="1") document.getElementById("uiViewErrorMessage").style.color="#CC3366" +; } function uiDoSave() { document.getElementById("uiPostUserName").value=document.getElementB +yId("uiViewUserName").value; document.getElementById("uiPostPassword").value=document.getElementB +yId("uiViewPassword").value; document.getElementById("uiPostForm").submit(); } </script> </head> <body onload="uiDoOnLoad()" bgcolor="#FFFFFF" leftmargin=0 topmargin=0 + marginwidth=0 marginheight=0> <form method="POST" action="../cgi-bin/webcm" target="_self" id="uiPos +tForm" > <input type="hidden" name="var:main" value="menu" id="uiPostMenuMain"> <input type="hidden" name="var:style" value="style5" id="uiPostMenuSty +le"> <input type="hidden" name="getpage" value="../html/defs/style5/menus +/menu.html" id="uiPostGetPage"> <input type="hidden" name="errorpage" value="../html/index.html" id="u +iPostErrPage"> <input type="hidden" name="var:pagename" value="home" id="uiPostPageNa +me"> <input type="hidden" name="var:errorpagename" value="home" id="uiPostE +rrorPageName"> <input type="hidden" name="var:menu" value="home" id="uiPostMenu"> <input type="hidden" name="var:menutitle" value="Home" id="uiPostMenuT +itle"> <input type="hidden" name="var:pagetitle" value="Home" id="uiPostPageT +itle"> <input type="hidden" name="var:pagemaster" value="home" id="uiPostPage +Master"> <input type="hidden" name="testwebcm" value="<? echo webcm ?>" id="u +iPostTestWebCM"> <input type="hidden" name="" value="<? error found ?>" id="uiPostError +State" disabled> <input type="hidden" name="login:command/username" value="" id="uiPost +UserName"> <input type="hidden" name="login:command/password" value="" id="uiPost +Password"> <input type="hidden" name="var:connecting1" value="0" id="uiPostConnec +ting"> </form> <!-- Outer Table--> <table width=761 cellpadding=0 cellspacing=0 align=center border=0 id +="loginPageTable" style="display:none"> <tr><td width=761 height=36 nowrap></td></tr> <tr> <td width=761 align=left valign=top> <!-- Main Page --> <form onsubmit="return false;"> <table cellspacing=1 border=0 cellpadding=4 align=center id="uiVie +wBodyTable" bgcolor="#000000" width="760" height="390"> <tr> <td bgcolor="#000000" height=22 class="header"><font size=1 co +lor="#FFFFFF">Please Log In to continue.</font></td> </tr> <tr> <td bgcolor="#ECECEC"> <table cellspacing=0 border=0 cellpadding=0 align=center id="uiV +iewBodyTable" width=300> <tr><td colspan=2 align=center class="header">Log In</td></tr> <tr><td colspan=2 height=8></td></tr> <tr><td colspan=2 height=1 bgcolor="#505050"></td></tr> <tr><td colspan=2 height=10></td></tr> <tr> <td nowrap align=right><font size=2 class="header"><b>Username +: </b></font></td> <td align=left><input type="text" value="" size="16" maxlength +="64" name="uiViewUserName" id="uiViewUserName"></td> </tr> <tr> <td nowrap align=right ><font size=2 class="header"><b>Passwor +d: </b></font></td> <td align=left><input type="password" value="" size="16" maxle +ngth="64" name="uiViewPassword" id="uiViewPassword""></td> </tr> <tr><td colspan=2 height=10></td></tr> <tr><td colspan=2 height=1 bgcolor="#505050"></td></tr> </table> </td> </tr> <tr> <td colspan=4 align=left bgcolor="#ECECEC" height=28> <table border=0 cellpadding=0 cellspacing=0 width="100%"> <tr> <td align=center id="uiViewErrorMessage" style="color:# +ECECEC;"><b>Error:&nbsp;<? error message ?>&nbsp;</b></td> <td align=right><input type="submit" value="Log In" onc +lick="uiDoSave()" class="inputButton"></td> </tr> </table> </td> </tr> </table> </form> <!-- END main Page --> </td> </tr> </table> <!-- END Outer Table --> </body> </html>

Basically i just want the script to login, check if the status is disconnected or then proceed to reboot the router.
Any advice on what am i doing wrong here?

In reply to Re^4: how to reboot adsl modem with perl? by MelaOS
in thread how to reboot adsl modem with perl? by MelaOS

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.