BEGIN {
    require Tk;
    import Tk;
}
require "pad.pl";

$top = tkinit;

sub docommand {
    local($comm) = shift;
    $pad->append("> $comm");
    $answer = eval $comm;
    $pad->append($@ ? $@ : $answer);
}

tclcmd("option", "add", "*Font" => "lucidasanstypewriter-12");
$pad = Pad::new($top);
# Perl5alpha6 has trouble with the following line...
#$pad->handler(\&docommand);
# ...so we do this instead...
$sref = \&docommand;
$pad->handler($sref);
tkpack $pad;
focus $pad;
tkmainloop;