[Chicago-talk] concurrent processes w/ Perl Tk

Richard Reina richard at rushlogistics.com
Tue Mar 9 19:20:53 PST 2010


Imran,

Thank you very much for you perlTk suggestion.  I've been playing around with it and I like it.  However, I have one big problem. I can't figure out how I can get the the values from buttons returned as a array or scalar. I execute the program and whoof! Where did the values I just selected go? If anyone has sample code of a very simple button that returns value, I would really appreciate it?

Thanks
---- Chicago.pm chatter <chicago-talk at pm.org> wrote:
>
> check out the "label and textinput" example in this web page:
> http://lena.franken.de/perl_hier/perltk_examples/index.html
> 
> On Tue, Mar 9, 2010 at 2:25 PM,  <richard at rushlogistics.com> wrote:
> > The reason I am launching it in another window is so that the user can enter the info in a small window data entry window at the bottom of the screen while still being able to see an image that is open in the background being viewed via evince.
> > Sent via my BlackBerry. Ignore all the typos.
> >
> > -----Original Message-----
> > From: imran javaid <imranjj at gmail.com>
> > Date: Tue, 9 Mar 2010 14:07:57
> > To: Chicago.pm chatter<chicago-talk at pm.org>
> > Subject: Re: [Chicago-talk] concurrent processes?
> >
> > Maybe what you are trying to do can be done better using perl/tk.
> > Using that can open an input window for the user. The window could
> > have an input box and an ok button, for example.
> >
> > On Tue, Mar 9, 2010 at 1:59 PM, imran javaid <imranjj at gmail.com> wrote:
> >> btw, in your original post you are running another perl interpreter
> >> inside the terminal and assigning a value to a variable. You will not
> >> be able to see that variable in your original program.
> >> the whole technique is a kluge.
> >>
> >> On Tue, Mar 9, 2010 at 1:55 PM, Brian Katzung <briank at kappacs.com> wrote:
> >>> Richard,
> >>>
> >>> Did I miss part of the discussion? It seems as if we're throwing out "1 foot
> >>> solutions" without seeing the "30,000 foot view".
> >>>
> >>> How about if we take a few steps backwards.
> >>>
> >>> In the bigger picture, what are you trying to accomplish, and why do you
> >>> believe it requires launching an interactive windows session and a new
> >>> terminal window rather than just prompting in the original execution
> >>> context?
> >>>
> >>>  - Brian
> >>>
> >>> Richard Reina wrote:
> >>>>
> >>>> That stops the error message but the rest of the program does not execute.
> >>>>
> >>>>
> >>>> ---- Chicago.pm chatter <chicago-talk at pm.org> wrote:
> >>>>
> >>>>>
> >>>>> The man page of exec() explains this:
> >>>>>
> >>>>> Since it's a common mistake to use exec instead of system, Perl warns
> >>>>> you if there is a following statement which isn't die, warn, or exit
> >>>>> (if -w is set - but you always do that). If you really want to follow
> >>>>> an exec with some other statement, you can use one of these styles to
> >>>>> avoid the warning:
> >>>>>
> >>>>>    exec ('foo')   or print STDERR "couldn't exec foo: $!";
> >>>>>    { exec ('foo') }; print STDERR "couldn't exec foo: $!";
> >>>>>
> >>>>>
> >>>>> On Tue, Mar 9, 2010 at 12:37 PM, Richard Reina
> >>>>> <richard at rushlogistics.com> wrote:
> >>>>>
> >>>>>>
> >>>>>> Shawn thanks for your reply. It looks promising but the program crashes
> >>>>>> with:
> >>>>>>
> >>>>>> Statement unlikely to be reached at test_exec.pl line 5.
> >>>>>>       (Maybe you meant system() when you said exec()?)
> >>>>>>
> >>>>>> Do I need some added syntax to use exec?
> >>>>>>
> >>>>>> ---- Chicago.pm chatter <chicago-talk at pm.org> wrote:
> >>>>>>
> >>>>>>>
> >>>>>>> Replace system w/ exec.  system() forks, exec does not.
> >>>>>>> shawn.c.carroll at gmail.com
> >>>>>>> Perl Programmer
> >>>>>>> Soccer Referee
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> On Tue, Mar 9, 2010 at 12:14, Richard Reina <richard at rushlogistics.com>
> >>>>>>> wrote:
> >>>>>>>
> >>>>>>>>
> >>>>>>>> I have a program that opens a terminal so that the user can enter some
> >>>>>>>> info.  Like this:
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> system(q{gnome-terminal --geometry=80x12+0-30 -x perl -e 'require
> >>>>>>>> "./data_entry1.pl"; my $co=get_input();'});
> >>>>>>>>
> >>>>>>>> # do something with $co
> >>>>>>>>
> >>>>>>>> The code works in that it opens a small terminal at the bottom of the
> >>>>>>>> screen where the user can enter info.  However, the program continues to
> >>>>>>>> execute without waiting for the value of $co. Is there a way to make the
> >>>>>>>> program wait until the terminal session has been terminated so that the
> >>>>>>>> value of $co can be obtained?
> >>>>>>>>
> >>>>>>>> Been banging my head on this one since 6:30am so any help would be
> >>>>>>>> greatly appreciated.
> >>>>>>>>
> >>>>>>>> Thanks
> >>>>>>>> Richard
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> ---- Chicago.pm chatter <chicago-talk at pm.org> wrote:
> >>>>>>>>
> >>>>>>>>>
> >>>>>>>>> On Mar 8, 2010, at 7:27 AM, Richard Reina wrote:
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>> system("gnome-terminal -x perl -e 'print "Hello World\n"; sleep
> >>>>>>>>>> 4;'");
> >>>>>>>>>>
> >>>>>>>>>
> >>>>>>>>> You have double quotes inside of that string.  You need to do either:
> >>>>>>>>>
> >>>>>>>>> system("gnome-terminal -x perl -e 'print \"Hello World\n\"; sleep
> >>>>>>>>> 4;'");
> >>>>>>>>>
> >>>>>>>>> or
> >>>>>>>>>
> >>>>>>>>> system(q{gnome-terminal -x perl -e 'print "Hello World\n"; sleep
> >>>>>>>>> 4;'});
> >>>>>>>>>
> >>>>>>>>> --
> >>>>>>>>> Andy Lester => andy at petdance.com => www.theworkinggeek.com =>
> >>>>>>>>> AIM:petdance
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>_______________________________________________
> >>>>>>>>> Chicago-talk mailing list
> >>>>>>>>> Chicago-talk at pm.org
> >>>>>>>>> http://mail.pm.org/mailman/listinfo/chicago-talk
> >>>>>>>>>
> >>>
> >>> --
> >>> Brian Katzung, Kappa Computer Solutions, LLC
> >>> Leveraging UNIX, GNU/Linux, open source, and custom
> >>> software solutions for business and beyond
> >>> Phone: 877.367.8837 x1  http://www.kappacs.com
> >>>
> >>>
> >>>_______________________________________________
> >>> Chicago-talk mailing list
> >>> Chicago-talk at pm.org
> >>> http://mail.pm.org/mailman/listinfo/chicago-talk
> >>>
> >>
> > _______________________________________________
> > Chicago-talk mailing list
> > Chicago-talk at pm.org
> > http://mail.pm.org/mailman/listinfo/chicago-talk
> > _______________________________________________
> > Chicago-talk mailing list
> > Chicago-talk at pm.org
> > http://mail.pm.org/mailman/listinfo/chicago-talk
> >
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk
> 


More information about the Chicago-talk mailing list