[Perl] Encode & Decode MD5 : GUI

เป็นโปรแกรม Perl ตัวแรกนะครับที่ผมเขียนเป็นแบบ GUI ถ้าผิดพลาดประการใดก็ขออภัยด้วยครับ (-/\-)
ปล. ด้านล่างไม่ใช่รูปของโปรแกรมนี้นะครับ ส่วนของโปรแกรมนี้มีแค่ En&De md5 แค่นั้น 55 ^^"


#!/usr/bin/perl -w
#########################################################################
# ░░░░░░░░░░░░░░░░░░░░░░░░░░ 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 Tk;
use LWP;
use Digest::MD5 qw(md5_hex);
$mw = new MainWindow; $mw->geometry('300x150'); $mw->title("Perl GUI");

########## Encode MD5 ##########
$en_md5 = $mw->Label(-text => “Encode MD5”)->pack;
$mw -> Entry(-textvariable => \$put_en_md5) -> pack;
$mw->Button(-text => “Gen”, -command => \&en_md5 )->pack;

sub en_md5 {
my $md5_hash = $put_en_md5;
my $md5_generated = md5_hex($md5_hash);
print “Encode MD5 : Result => $md5_generated\n”;
########## Create New Form ##########
$mw = new MainWindow; $mw->geometry(‘350×70’); $mw->title(“Encode MD5 : Result”);
$mw->Label(-text => “$put_en_md5”)->pack;
my $frm_name = $mw -> Frame() -> pack(); #New Frame
my $ent = $frm_name -> Entry(-text => $md5_generated) -> pack (-ipadx => 60,-ipady => 5);
}
########## Decode MD5 ##########
$de_md5 = $mw->Label(-text => “Decode MD5”)->pack;
$mw -> Entry(-textvariable => \$put_de_md5) -> pack;
$mw->Button(-text => “Gen”, -command => \&de_md5 )->pack;

sub de_md5 {
my $md5 = $put_de_md5;
$lwp = LWP::UserAgent->new;
$lwa = $lwp->get(‘http://md5.rednoize.com/?p&s=md5&q=’.$md5);
$hash = $lwa->content;
print “Decode MD5 : Result => $hash\n”;
########## Create New Form ##########
$mw = new MainWindow; $mw->geometry(‘350×70’); $mw->title(“Decode MD5 : Result”);
$mw->Label(-text => “$put_de_md5”)->pack;
my $frm_name = $mw -> Frame() -> pack(); #New Frame
my $ent = $frm_name -> Entry(-text => $hash) -> pack (-ipadx => 60,-ipady => 5);
}
MainLoop;