Perl Programs Serving Web Pages 
Author Message
 Perl Programs Serving Web Pages

Hi,

I have a series of perl files which send and receive files through the use
of sockets.

What I would like to be able to do, it within the same set of files, which
currently run as perl daemons to serve some simple web pages, with status
and stats in etc.

Does anyone know of any perl modules available that would allow for this to
happen.

Ideally someone would connect on say 127.0.0.1:8085 or whatever port is
specified and it would output a set of html files, which would also include
dynamic information from the perl program.

Any ideas?

Adam

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system ( http://www.*-*-*.com/ ).
Version: 6.0.463 / Virus Database: 262 - Release Date: 17/03/2003



Tue, 13 Sep 2005 08:51:19 GMT  
 Perl Programs Serving Web Pages

Quote:

> I have a series of perl files which send and receive files through the use
> of sockets.

> What I would like to be able to do, it within the same set of files, which
> currently run as perl daemons to serve some simple web pages, with status
> and stats in etc.

[...]

Quote:
> Ideally someone would connect on say 127.0.0.1:8085 or whatever port is
> specified and it would output a set of html files, which would also include
> dynamic information from the perl program.

Most Perl modules for web services assume they're the only things
running, so doing all this in one process will not be trivial.

One option is to move to a networking framework (POE is one) that
supports multiple tasks.  This may or may not be a hard task,
depending on how your programs are currently structured.

Another option is to fork off a "dedicated" web server (there are
several modules for this; see http://search.cpan.org/).  You can
periodically push program statuses to the server through one or
another form of IPC.

Probably the easiest option is to dump the program status to a file
every minute or so, and serve it out of a regular httpd.  This is not
a single-file solution, though.

If you think restructuring the tools will be useful, here are some
resources that might help.

http://poe.perl.org/?Tutorials
 - POE for IO::Select/IO::Socket users.

http://poe.perl.org/?POE_Cookbook/Combined_Services
 - A telnet chat server with a web interface.

http://poe.perl.org/?POE_Cookbook
 - Several example servers, clients, and other things.

Good luck.




Wed, 14 Sep 2005 13:59:07 GMT  
 Perl Programs Serving Web Pages
Hi

Using POE is one option although it is not my prefered.

Using httpd is not an option, as this is for a client program that can be
run on any posix platform, although it would be nice if it ran on Windows
as well...

I do not have any problems forking off a new process since most of the
program operates this way.

It looks like using a standard perl module that runs in its own process
would be the best option. The output is pretty much fixed for the duration
of one of the forked process, as the program is a client to a distributed
processing system.

Any idea which are the best CPAN modules to use, search.cpan.org seems to
be off line at the momment.

Adam

Quote:


> > I have a series of perl files which send and receive files through the use
> > of sockets.

> > What I would like to be able to do, it within the same set of files, which
> > currently run as perl daemons to serve some simple web pages, with status
> > and stats in etc.

> [...]

> > Ideally someone would connect on say 127.0.0.1:8085 or whatever port is
> > specified and it would output a set of html files, which would also include
> > dynamic information from the perl program.

> Most Perl modules for web services assume they're the only things
> running, so doing all this in one process will not be trivial.

> One option is to move to a networking framework (POE is one) that
> supports multiple tasks.  This may or may not be a hard task,
> depending on how your programs are currently structured.

> Another option is to fork off a "dedicated" web server (there are
> several modules for this; see http://search.cpan.org/).  You can
> periodically push program statuses to the server through one or
> another form of IPC.

> Probably the easiest option is to dump the program status to a file
> every minute or so, and serve it out of a regular httpd.  This is not
> a single-file solution, though.

> If you think restructuring the tools will be useful, here are some
> resources that might help.

> http://poe.perl.org/?Tutorials
>  - POE for IO::Select/IO::Socket users.

> http://poe.perl.org/?POE_Cookbook/Combined_Services
>  - A telnet chat server with a web interface.

> http://poe.perl.org/?POE_Cookbook
>  - Several example servers, clients, and other things.

> Good luck.





Wed, 14 Sep 2005 19:08:22 GMT  
 Perl Programs Serving Web Pages

Quote:

> I have a series of perl files which send and receive files through the
> use of sockets.

> What I would like to be able to do, it within the same set of files,
> which currently run as perl daemons to serve some simple web pages, with
> status and stats in etc.

> Does anyone know of any perl modules available that would allow for this
> to happen.

> Ideally someone would connect on say 127.0.0.1:8085 or whatever port is
> specified and it would output a set of html files, which would also
> include dynamic information from the perl program.

I would recommend a slightly different approach. Let a real web server
(e.g., Apache) front-end the HTTP requests. Configure the web server to
forward the requests to a set of new daemons using the FastCGI protocol.
Your new daemons then "use CGI::Fast;" and have a simple main loop:

    while( $cgi = new CGI::Fast ) {
        print STDOUT "<h1>some html</h1>\n";
    }

These new daemons can either interact with your existing daemons to acquire
the raw data or use the same mechanism as your existing daemons.

This approach is a) flexible, b) performant, c) trivial to implement,
d) easier to secure.



Thu, 15 Sep 2005 01:13:44 GMT  
 Perl Programs Serving Web Pages
Hi,

Unfortunately using apache is not an option, as it would mean the client
machine having to have it installed.

I need something compact that requires no user set-up, it will only be used
by the owner of the client computer to see what job is being run on his
computer by the job.

Adam



Quote:

> > I have a series of perl files which send and receive files through the
> > use of sockets.

> > What I would like to be able to do, it within the same set of files,
> > which currently run as perl daemons to serve some simple web pages, with
> > status and stats in etc.

> > Does anyone know of any perl modules available that would allow for this
> > to happen.

> > Ideally someone would connect on say 127.0.0.1:8085 or whatever port is
> > specified and it would output a set of html files, which would also
> > include dynamic information from the perl program.

> I would recommend a slightly different approach. Let a real web server
> (e.g., Apache) front-end the HTTP requests. Configure the web server to
> forward the requests to a set of new daemons using the FastCGI protocol.
> Your new daemons then "use CGI::Fast;" and have a simple main loop:

>     while( $cgi = new CGI::Fast ) {
> print STDOUT "<h1>some html</h1>\n";
>     }

> These new daemons can either interact with your existing daemons to
acquire
> the raw data or use the same mechanism as your existing daemons.

> This approach is a) flexible, b) performant, c) trivial to implement,
> d) easier to secure.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.465 / Virus Database: 263 - Release Date: 25/03/2003


Thu, 15 Sep 2005 05:12:33 GMT  
 Perl Programs Serving Web Pages

Quote:

> It looks like using a standard perl module that runs in its own process
> would be the best option. The output is pretty much fixed for the duration
> of one of the forked process, as the program is a client to a distributed
> processing system.

> Any idea which are the best CPAN modules to use, search.cpan.org seems to
> be off line at the momment.

Not off-hand.  search.cpan.org is reportedly back up, so you should be
able to hit like a dozen of them without much effort.




Thu, 15 Sep 2005 10:15:33 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. "Cannot access directory" on W2000 with paradox table via BDE

2. MS SQLOLE for SQL-Server

3. "Exceeded line length" in Const

4. Problem serving up Perl CGI script as web page

5. Problem serving up Perl CGI script as web page

6. Perl script to serve up different HTML pages at different times of day

7. Input a web page to a perl program

8. looking for BGI to emulate Herc on VGA

9. store an OleContainer.Object to an MSSQL image or text filed

10. Running an auth module before serving pages

11. Apache wouldn't serve pages

12. Pub needs automated web page generator program

 

 
Powered by phpBB® Forum Software