I'm writing a login gui in perl and I've got a mental block:

I've created my gui:

my $main = Win32::GUI::Window->new(
        -name   => 'Main',
        -width  => 600,
        -height => 400,
        -text   => 'GHS Login',
        -sizable=> 0,
        -hasminimize => 0,
        -hasmaximize=> 0,
… widgets positioned

My question is, how can I get the  window to be displayed and then have perl code running in the background?
I've tried:
sub Main_Activate {
        … perl code
return 0;
The perl code runs and then the window appears.

Brian Rowlands
We must accept finite disappointment, but we must never lose infinite hope.
Martin Luther King Jr.