Check scripting language latest version and generate a table - verchk.pl
use LWP::Simple;
use Net::FTP;
$| = 1;
while(<DATA>){
($site,$url)=split(/\s+/,$_);
if($site =~ /ActivePerl/i){
if((get $url) =~ /ActivePerl\s*(\d+\.\d+\.\d+\.\d+)/i){
print "ActivePerl latest release is $1.\n";
push(@ver,join("\t",$site,$1,$url));
}
}elsif($site =~ /Ruby/i){
if((get $url) =~ /ruby-(\d+\.\d+\.\d+)/){
print "Ruby latest version is $1.\n";
push(@ver,join("\t",$site,$1,$url));
}
}elsif($site =~ /Python/){
if((get $url) =~ /Python\s*(\d+\.\d+\.\d+)/i){
print "Python version is $1.\n";
push(@ver,join("\t",$site,$1,$url));
}
}elsif($site =~ /Tcl\/Tk/){
if((get $url) =~ /Tcl\/Tk\s*(\d+\.\d+\.\d+)/){
print "Tcl/Tk latest release is $1.\n";
push(@ver,join("\t",$site,$1,$url));
}
}
}
open(OUT,"> slver.html");
print OUT <<EOB;
<HTML>
<HEAD><TITLE>Scripting Language Latest Version</TITLE></HEAD>
<BODY BGCOLOR="#FFFFF0">
<FONT COLOR="#000080">Scripting Language Latest Version</FONT>
<HR><BR>
<TABLE BORDER>
<TR>
<TH>Scripting Language</TH>
<TH>Latest Version</TH>
<TH>Source</TH>
<TR>
EOB
foreach (@ver){
($site, $ver, $url) = split(/\t/,$_);
print OUT "<TR>\n\t<TH>$site</TH>\n\t<TH>$ver</TH>\n\t<TH><A HREF=\"$url\">$url</A></TH>\n</TR>\n";
}
print OUT "</TABLE>\n";
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$thisday = (Sun,Mon,Tue,Wed,Thu,Fri,Sat)[$wday];
$thismonth = (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)[$mon];
print OUT "<I>Last updated : $hour:$min:$sec $thismonth $mday ($thisday) ", $year+1900,"</I><BR>\n";
print OUT <<EOE;
</TABLE>
<BR><HR>
<FONT COLOR="#000080">
This table is generated by <A HREF="verchk.html">verchk.pl</A></FONT><BR>
This HTML is transported by Net::FTP module.<BR>
<I><A HREF="index.html">TS Network ☆ミ</A></I>
&#32<FONT COLOR="ORANGERED">&gt;&gt;</FONT>
</BODY>
</HTML>
EOE
close(OUT);
$ftp = Net::FTP->new('ftp.*****.com');
print "ftp.*****.comに接続しました。\n";
$ftp->login('********','********');
print "loginしました。\n";
$ftp->cwd("/homepage");
print "/homepageディレクトリに移動しました。\n";
$ftp->ascii();
print "asciiモードにします。\n";
$ftp->put("slver.html","slver.html");
print "slver.htmlを転送しました。\n";
$ftp->quit();
print "FTPを終了しました。\n";
__END__
ActivePerl http://www.activestate.com/ASPN/Downloads/ActivePerl/
Ruby http://www.ruby-lang.org/en/download.html
Python http://www.python.org/download/
Tcl/Tk http://dev.scriptics.com/
TS Network ☆ミ >>
(C)jscripter