Perl : PDF album Downloader [ SS : GUI ]

SS : เป็นแบบ GUI นะครับ แต่โค้ดด้านล่างเป็นแบบธรรมดา ^^”


#!/usr/bin/perl
#########################################################################
# ░░░░░░░░░░░░▄▄░░░░░░░░░░░░░░ Copyright (c) 2012 by sornram9254.com
# ░░░░░░░░░░░█░░█░░░░░░░░░░░░░
# ░░░░░░░░░░░█░░█░░░░░░░░░░░░░ This software is open source,
# ░░░░░░░░░░█░░░█░░░░░░░░░░░░░ licensed under the GNU/GPL,v3.0
# ░░░░░░░░░█░░░░█░░░░░░░░░░░░░
# ██████▄▄█░░░░░██████▄░░░░░░░ Basically,
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░ this means that you're allowed to modify and
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░ distribute this software.
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░ However, if you distribute modified versions,
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░ you MUST also distribute the source code.
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░
# ▓▓▓▓▓▓█████░░░░░░░░░██░░░░░░ See http://www.gnu.org/licenses/gpl.html
# █████▀░░░░▀▀████████░░░░░░░░ for the full license.
#########################################################################
use LWP::Simple;
print "Create new Album...\nName : ";
$album = ;
mkdir($album);
my $ua = LWP::UserAgent->new();
my $content = $ua->get('http://www.eduunix.ccut.edu.cn/index/pdf/')->content;
print "=============================================\n";
print "Please wait to Download...\n";
print "=============================================\n";
while($content =~ m/<\/td>/g){
$file = $1;
$url = "http://www.eduunix.ccut.edu.cn/index/pdf/".$file;
print "Getting ==> $file ..\n";
my $data = LWP::Simple::get $url;
my $filename = $file;
open (FH, "> /home/sornram9254/$album/$filename");
binmode (FH);
print FH $data;
close (FH);
print "\tDone ..\n";
sleep(1);
}

 

 

อยากได้ลูกเล่นอะไรเพิ่มเติมก็ลองไปโมฯกันเองนะครับ ^_^