Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > How do I pass interactive commands in this case?

Reply
Thread Tools

How do I pass interactive commands in this case?

 
 
grocery_stocker
Guest
Posts: n/a
 
      12-04-2006
I have a program that access's a bbs. When I do the following:
#!/usr/bin/perl -w
my $kidpid;
if (!defined($kidpid = fork())) {
die "cannot fork: $!";
} elsif ($kidpid == 0) {

exec("bbs");
die "can't exec date: $!";

} else {

waitpid($kidpid, 0);


}

I get
23 newresponse items and 2 brandnew items
First item 1, last 34

Ok:


The problem is that I want to pass the bbs 'browse' command at the
"Ok:"
prompt. Ie when I run the perl script, I want it to go like:

23 newresponse items and 2 brandnew items
First item 1, last 34

Ok:browse

Ideas?

 
Reply With Quote
 
 
 
 
grocery_stocker
Guest
Posts: n/a
 
      12-05-2006

A. Sinan Unur wrote:
> "grocery_stocker" <(E-Mail Removed)> wrote in
> news:(E-Mail Removed) ps.com:
>
> > I have a program that access's a bbs. When I do the following:
> > #!/usr/bin/perl -w
> > my $kidpid;
> > if (!defined($kidpid = fork())) {
> > die "cannot fork: $!";
> > } elsif ($kidpid == 0) {
> >
> > exec("bbs");
> > die "can't exec date: $!";

>
> The fork+exec means that this process has now been replaced with the bbs
> process. Interacting with that process is now no different than
> interacting with any other external process.
>
> Have you looked into Expect.pm?
>


I've used expect once. It was sort of fuzzy the first time I used it.
It was the same sort of fuzziness
that I had when I first dealt with pointers in C..

> >
> > } else {
> >
> > waitpid($kidpid, 0);
> >
> >
> > }

>
>
> ...
>
> >
> > The problem is that I want to pass the bbs 'browse' command at the
> > "Ok:"prompt. Ie when I run the perl script, I want it to go like:
> >
> > 23 newresponse items and 2 brandnew items
> > First item 1, last 34
> >
> > Ok:browse

>
> http://search.cpan.org/~rgiersig/Expect-1.20/
>
> Does the bbs program read its input from STDIN?
>

I'm not that sure if the bbs reads from STDIN. Is there any way to find
out?

> Do you need to read the responses from bbs?
>


Yes. I've also read the man pages for the bbs seeing if there was some
way I could perhaps
pass the browse option at the command line vs typing bbs and then
typing browse at the
"OK" prompt. There is no such option. All the command line options to
the bbs are used to
control how text gets inputed when you read or write a response to a
thread.

> Look also at "Bi-directional Communication with Another Process" in
> perldoc perlipc
>
>
> Sinan
> --
> A. Sinan Unur <(E-Mail Removed)>
> (remove .invalid and reverse each component for email address)
>
> comp.lang.perl.misc guidelines on the WWW:
> http://augustmail.com/~tadmc/clpmisc...uidelines.html


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Interactive Commands Ferruccio Vitale Java 4 03-25-2005 09:38 AM
Interactive/Non-interactive ASPX ? WJ ASP .Net 2 02-26-2005 02:54 AM
non Interactive and Interactive AAH Computer Support 0 01-09-2005 04:09 PM
Interactive and non interactive AAH Computer Support 1 01-09-2005 04:01 PM



Advertisments