[Chicago-talk] concurrent processes?

Richard Reina richard at rushlogistics.com
Tue Mar 9 11:29:54 PST 2010


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
> > > >>
> > > > _______________________________________________
> > > > 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