#!/usr/bin/perl use strict; use warnings; use Tk; use DBI; my $mw = MainWindow->new; $mw->geometry("500x300+600+200"); my $text; $mw->title("Account Details"); $mw->Label( -text => "Card Number:" )->pack(-side => 'top'); my $card = $mw->Entry(-textvariable => '', -background => 'white', -width => 24)->pack(-side => 'top'); $mw->Button( -text => "Check Account", -command => \&check_card, )->pack(-side => 'top'); $mw->Button( -text => "Done", -command => sub {exit} )->pack(-side => 'top'); MainLoop; sub check_card { my $cardno = $card->get(); if(length $cardno =="0"){ error_no_card(); } elsif(length $cardno > "0") { $mw->Label(-text => "\nChecking Account Details for '$cardno'.\n Please Wait......\n", -width => 54)->pack(); } if(length $cardno > "0"){ my $exists = check_in_SQLStore($cardno); if($exists =="0"){ print "We got nothing\n"; } } } sub error_no_card { $mw->messageBox(-title => "Error!", -type=>'ok', -message => "Please enter an Account Card number!",); }