#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    3
    Rep Power
    0
    I am very, very, very new to CGI / Pearl, so I apologize in advance for my vast ignorance on this subject. My task is to find a way interface a CGI program with a DOS program sitting on a UNIX server. Here are the specifics:

    From a web browser, a user will start up a DOS program sitting on a UNIX server. The DOS program will send output to the user's web browser that will be displayed as HTML. The user will then enter some input into the web browser, which will then be sent back to the DOS program for processing. Next the DOS program will send output, based on the user's last input, back to the user's web browser. And so on.

    Is this possible? If so, can someone help me understand how to do this? Code examples would be greatly appreciated since I don't really understand much about Pearl yet. Again, I'd be tremendously thankful if someone could help solve this problem, or perhaps point me to a site where I might be able to get some help.


    ------------------
    All the world's a stage, and all the men and women merely players...
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2000
    Location
    Indiana
    Posts
    614
    Rep Power
    15
    You can't run a DOS program on a Unix OS, that's why it's called a DOS program.

    I suggest you find a way to do whatever the "DOS" program does, in perl. (and yes, it's Perl, not Pearl ).
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    3
    Rep Power
    0
    Sorry about the Pearl/Perl thing

    Anyway, I thought what you're saying too...I mean, how can these people run a DOS program on a UNIX machine? I'll have to get more details on whether they actually can run this DOS program in UNIX, or whether that's just wishful thinking. Assuming they can, does anyone have any ideas?


    ------------------
    All the world's a stage, and all the men and women merely players...
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2000
    Location
    Indiana
    Posts
    614
    Rep Power
    15
    Well there isn't a category of programs called "DOS programs". Just programs that are designed and compiled for and under that OS. You can run a .exe file on a Unix server, if it's deigned for a Unix server.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    300
    Rep Power
    14
    Just it wouldn't be an .exe file...ELF binary maybe???
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    3
    Rep Power
    0
    Okay, if let's assume it's just some sort of executable, maybe not an EXE, but whatever type of program is native to Unix..or let's assume that the DOS program is running in a DOS emulator on Unix. Whatever, that's not the most urgent thing for me at this point.

    My questions deal with how I would:

    1. Start up the program.
    2. Receive its output.
    3. Format its output as HTML and send to the user's browser.
    4. Send new input to it.
    5. Receive its output.
    6. Format its output as HTML and send to the user's browser.
    7. Etc, etc, etc...

    Can anyone provide some simple code examples for me on how this is accomplished in Perl? Thanks in advance.




    ------------------
    All the world's a stage, and all the men and women merely players...
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    300
    Rep Power
    14
    Well, one way would be to mimic what the program is doing in Perl. If you can do that, I would suggest it.

    But, it is most likely that you cannot do that, so off we go into a different approach. What you are trying to do, by the looks of it, is called "opening bidirectional pipes". Perl alone cannot do this. You will need to use one of the modules that comes standard with Perl and is called IPC::Open2. It is not that hard to use, but you should read the docs first. Try

    perldoc IPC:Open2

    and it should give you its man page where you can see how to use it. HTH.

IMN logo majestic logo threadwatch logo seochat tools logo