For various reasons, not least of which is I'm running a database creator that times out in Apache (when I already have the timeout set at two thousand seconds) and I figure that running the script from command line makes sense here.

The problem - I've got a nice, simple GUI using Perl/Tk - it doesn't need to be fancy - BUT I'm stumped at how to get the information from the GUI into either a simple data file OR directly into the script that needs to use it.

I've gone through the various Perl/Tk tutorials I can find on the 'net and I haven't seen anything that applies.

#!/usr/bin/perl # $Id: tkform1 $ # $Date: 1.25.11 $ # $HeadURL: adamant.net $ # $Revision: 2011 $ # $Source: /tkform1.pl $ ###################################################################### +############ use strict; use warnings; use Tk; our $VERSION = 1.00; my($model, $DATABASE); my $mw = new MainWindow; my $label = $mw -> Label(-text=>"Population Model Form") -> pack(); my $rdb_1 = $mw -> Radiobutton(-text=>"Model 1", -value=>1, -variable=>\$model)-> pack(); my $rdb_2 = $mw -> Radiobutton(-text=>"Model ", -value=>2,-variable=>\$model)-> pack(); my $lab1 = $mw -> Label(-text=>"Initial #:") -> pack(); my $initial = $mw -> Entry(-width=>5,) -> pack(); my $lab2 = $mw -> Label(-text=>"Copying Error % +/-") -> pack(); my $copyerr = $mw -> Entry(-width=>5,) -> pack(); my $lab3 = $mw -> Label(-text=>"How many Year -> population estimates +do you have?") -> pack(); my $LST = $mw -> Entry(-width=>10) -> pack(); my $button = $mw -> Button(-text => "Submit", -command =>\&exitProgam) -> pack(); MainLoop; sub exitProgam { $mw->messageBox(-message=>"Goodbye"); } #sub data_in{ #open my $DATABASE, '>', 'data_in1.txt' or croak 'data_in1 not written +.'; #print {$DATABASE} qq{$model|$initial|$copyerr|$LST\n} or croak 'unabl +e to print'; #close $DATABASE or croak 'data_in1 not closed.'; #} exit;

$model, $initial, $copyerr, and $LST are the variables the next script needs. Also, when I un-comment 'data_in' and replace 'exitProgram' with 'data_in' in 'my $button', the script and/or errors run by so fast I can't read them (Win XP), so obviously I'm missing something.


In reply to Perl/Tk confusion by Dandello

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.