Re: command line interface handling asynchronicity

2003-11-28 Thread drieux
On Thursday, Nov 27, 2003, at 17:49 US/Pacific, John W. Krahn wrote: Philipp Traeder wrote: [..] If I am not mistaken, this is more or less exactly what I am doing right now - the only problem I have got with this is that the user is interrupted in his work when the 'long_action' finishes - like t

Re: command line interface handling asynchronicity

2003-11-28 Thread R. Joseph Newton
Philipp Traeder wrote: Hi Phillip, Sorry. That last example cheated with a long, hard-coded wait. Below is something that speaks a little more closely to the problem. ... > b) How can I set up the ReadLine() part in a way that the user is able > to type new actions, but can receive new message

Re: command line interface handling asynchronicity

2003-11-28 Thread R. Joseph Newton
Philipp Traeder wrote: > ... > b) How can I set up the ReadLine() part in a way that the user is able > to type new actions, but can receive new messages (from finished long > actions) as well? I have played around with Term::ReadKey, and ended up > with something like this: Are you looking for

Re: command line interface handling asynchronicity

2003-11-27 Thread John W. Krahn
Philipp Traeder wrote: > > > It is pretty simple, the perlipc man page has some good examples, but it > > is basically like this: > > > > elsif ( $cmd eq 'long_action' ) { > > defined( my $pid = fork ) or die "Cannot fork: $!"; > > unless ( $pid ) { > > # execute th

Re: command line interface handling asynchronicity

2003-11-27 Thread drieux
On Thursday, Nov 27, 2003, at 14:10 US/Pacific, Philipp Traeder wrote: [..] The danger of primates banging on keyboards is - of course - always existent and quite high, but in this case I would settle for a first version that would be usable by more or less normal beings of the species homo [EMAIL

Re: command line interface handling asynchronicity

2003-11-27 Thread Philipp Traeder
> Not related to your question but, have you thought of using a dispatch > table instead? > > sub help { > # process help > } > > sub long_action { > # process long_action > } > > my %process = ( > help=> \&help, > long_action => \&long_action, > simple_cmd =

Re: command line interface handling asynchronicity

2003-11-27 Thread Philipp Traeder
On Thu, 2003-11-27 at 21:37, drieux wrote: > > On Thursday, Nov 27, 2003, at 09:58 US/Pacific, Douglas Lentz wrote: > > > Re: (A) What's the best way for the child to inform the parent that > > it's done?. > > > Given that his question (A) is about 'informing' > the parent that it is finished, h

Re: command line interface handling asynchronicity

2003-11-27 Thread John W. Krahn
Philipp Traeder wrote: > > Good morning everybody, Hello, > I am writing a small console application, allowing the user to perform > some actions via a shell-like interface. The basics of this were rather > easy, and with the help of some very nice CPAN modules (i.e. > Base::Shell), I have got t

Re: command line interface handling asynchronicity

2003-11-27 Thread drieux
On Thursday, Nov 27, 2003, at 09:58 US/Pacific, Douglas Lentz wrote: Philipp Traeder wrote: Good morning everybody, [..] # ... elsif ($cmd eq 'long_action') { if (!fork) { # execute the action in the child process sleep 10; # TODO: noti

Re: command line interface handling asynchronicity

2003-11-27 Thread Douglas Lentz
Philipp Traeder wrote: Good morning everybody, I am writing a small console application, allowing the user to perform some actions via a shell-like interface. The basics of this were rather easy, and with the help of some very nice CPAN modules (i.e. Base::Shell), I have got tab-completion, a hel