in reply to Re: Perl/Tk confusion
in thread Perl/Tk confusion

I'm so confused about this conversion I don't even know what questions to ask.

What I was hoping to do is get the values from the widgets and pass them (either directly or through a file) to another script that can run in the background as long as it needs. I can already do this using Apache, but since the long-running script is going to be run on a different machine, I was hoping to just load Perl on it and not worry about configuring Apache on this other machine.

Replies are listed 'Best First'.
Re^3: Perl/Tk confusion
by zentara (Cardinal) on Jan 25, 2011 at 13:56 UTC
    Here, try this script. It should get you started.
    #!/usr/bin/perl use warnings; use strict; use Tk; my $MainWindow = MainWindow->new; $MainWindow->title("Data Entry Form"); my $NameOfPerson; # global variable $MainWindow -> Label(-justify => 'left', -text => "Name of person : ") ->pack(-side => 'left',-anchor => 'n'); my $entry = $MainWindow -> Entry(-selectborderwidth => 10) ->pack(-side => 'top',-anchor => 'n'); $entry->bind('<Return>',[\&somesub]); $entry->focus; $MainWindow -> Button(-text => "OK", -command => \&somesub) ->pack(-side => 'bottom',-anchor => 'center'); MainLoop; #your script can continue here after Tk is done while(1){print time."\t$NameOfPerson\n"; sleep 1;} sub somesub { $,="\n"; $NameOfPerson = $entry -> get; print "\nNameOfPerson ->$NameOfPerson\n"; $MainWindow -> destroy; }

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh