Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: converting a command-line program to one with a "pretty" interface

by NetWallah (Canon)
on Dec 06, 2004 at 21:20 UTC ( [id://412760]=note: print w/replies, xml ) Need Help??


in reply to Re^2: converting a command-line program to one with a "pretty" interface
in thread converting a command-line program to one with a "pretty" interface

Reading your concerns on HTTP::Daemon, and paulbort's reaction, I had a thought - your requirements are pretty basic - to be able to communicate state/status information from a service to the outside world. It occurred to me that this is essentially a one-way communication. If security is not an issue, I think the simplest solution would be to have the service periodically pump out UDP packets containing state information. If there is a program listening, it can read, format, and display the information, otherwise, the info gets thrown away. This could be implemented with a simple UPD socket writer.

If you need more sophesticated Controls (bi-directional communication), and did not want to fork, you could try Net::Server::NonBlocking.

    ...each is assigned his own private delusion but he cannot see the baggage on his own back.

  • Comment on Re^3: converting a command-line program to one with a "pretty" interface

Replies are listed 'Best First'.
Re^4: converting a command-line program to one with a "pretty" interface
by punkish (Priest) on Dec 06, 2004 at 22:14 UTC
    I too started off (this thread) by thinking that my requirements were basic. Now I am thinking that perhaps they are not.

    If I were to provide an example of what I want, I would point to the little control thingy for Apache that sits in the Windows system-tray. You can start, stop, restart the Apache service. You can't config Apache through this (you can't config Apache any way other than editing the httpd.conf file by hand anyway) but this is the closest I can think of as an example of what I want to accomplish.

    Except, I would like to use a web-based interface for my own program to do what this Apache thingy does instead of a native Win doohickey.

    I would also like to use the web interface to modify some of the conf params. This portion seems easy -- I can use Config::Simple or some such, or just open up a conf file, tie the values to a hash, and display them in an html form that can then be used to modify and save the conf file back out again.

    What I can't grasp is how to control a non-web, continuously running program via a web interface.

    Why do I want a web interface? Simply because the web is about as cross-platform an interface technology as one can get. My current program is just a simple Perl script that is launched from the command line, and it runs until Ctrl-C or until it die-s because of some boo-boo. I am thinking of evolving this to something that can be controlled by another program (my web interface), can be eventually cross-platform -- it is right now running on Windows, hence, my evolution to a Win service, but there is no reason why it couldn't run on a *nix box.

    I am answering paulbort and Tachyon's comments right here -- I don't have to read the params everytime the script wakes up. It just reads them when it launches until it dies, much like what Apache does. I certainly do not want to muck around with Win registry -- shudder.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://412760]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-25 07:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found