Practical Extraction and Report Language/Common Gateway Interface
- April 7th, 2008
- Write comment
Simply known as PERL and CGI respectively. I decided to change my priorities in studying “Web based apps” from ASPX to Perl and CGI scripting because of the flexibility, powerfulness of this language. Also what is good about it is that I can work in different O.S platforms and I can work also both in Web, Client based or a mixture of them. My first Perl script is a couple of months ago when I made a automatic restart/redial of my DSL modem (which I revised when I changed my ISP and its modem).
#DSL Modem Script #used to reboot Huawei and Prolink modems #(C)opyright 2007 by Michael Angelo Yap. All Rights Reserved. #!/usr/bin/perl -w use strict; use Net::Telnet; use Time::Local; my ($host, $port, $user, $pass, $command); $host = '192.168.1.1'; $port='xxxx'; #replaced for security reasons, duhh! $user='yyyy'; #replaced for security reasons, duhh! $pass='zzzz'; #replaced for security reasons, duhh! my ($sec,$min,$hour,$mday,$mon,$year, $wday,$yday,$isdst) = localtime time; my($vart)="$hour:$min"; if($vart eq "HH:MM") #replaced for security reasons, duhh! { my $tn = new Net::Telnet(Host => $host, Port => $port,Timeout => 10) or die "connect failed: $!"; $tn->open ($host); $tn->waitfor('/login: $/i'); $tn->print($user); $tn->waitfor('/password: $/i'); $tn->print($pass); $tn->waitfor('/\$$/i'); $tn->print('reboot'); $tn->print('exit'); }
super basic, but so very important to me!













