Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

perl-based server for use by CGI scripts.

by kiz (Monk)
on Feb 20, 2002 at 14:42 UTC ( [id://146587]=perlquestion: print w/replies, xml ) Need Help??

kiz has asked for the wisdom of the Perl Monks concerning the following question:

I am about to embark on a (small ?) project to write a server-thing to farm images for a Web-based service we are prototyping.

One of the things that we'd like (to take the opportinity) to prove is some form of persistent, memory-resident server.

(Seeing as you asked, it means we can create Z39:50 connections that persist across multiple HTTP sessions.
Z39.50 is an international standard for communication between computer systems primarily, library and information related systems. It requires a persistant connection to enable subsequent data retrivals.)

So far, I have two thoughts on this (both of which may be wrong :) -

Create a Perl package, and load it into a mod-perl-enabled apache-server at startup.
Use this to create a global nested-hash data-structure that is therefor accessable for all child-processes. It uses a system of session IDs to assocciate references to particular user-requests.
Create a Perl script (completely seperate form any web servers) that sits in an endless loop, and uses IO Sockets to pass data back and forth.
This is a much more complex idea, which worries me... (and I have never done any IPC-stuff before :)

My basic questions are

  • Are either of these way off-base, and unworkable
  • Has anyone does something like this before, and can they offer some suggestions for ideas and possible pitfalls

-- Ian Stuart
A man depriving some poor village, somewhere, of a first-class idiot.

  • Comment on perl-based server for use by CGI scripts.

Replies are listed 'Best First'.
Re: perl-based server for use by CGI scripts.
by chromatic (Archbishop) on Feb 20, 2002 at 17:58 UTC
    The first sounds complicated. The second is possible. Jellybean does it, POE could do it, and Matts has something called PPerl that might do the trick. (I don't know if he's put it up on the CPAN yet.)
Re: perl-based server for use by CGI scripts.
by rinceWind (Monsignor) on Feb 20, 2002 at 15:13 UTC

    You might want to take a look at openframe. I've not used it myself, but apparently it's been released on CPAN.

Re: perl-based server for use by CGI scripts.
by beebware (Pilgrim) on Feb 20, 2002 at 17:36 UTC
    Can you let me know where you got the Z39.50 code as I've been looking for client-side code for ages! Cheers.
      The Man In The Know says we have been using something called Zeta, except the web pages for it have disappeared, so I guess it's unsupported now.

      He is going to look at Net::Z3050 module in CPAN

      -- Ian Stuart
      A man depriving some poor village, somewhere, of a first-class idiot.

        While there is plenty of software around for the Z39.50 protocol - Zeta Perl doesn't seem to be available for download anymore (it may be because Indexdata who provide the 'Yaz' toolkit for Z39.50 is also unavailable - but it could just be a horrible coincidence). I have seen Net::Z3950 available via ZZPerl, but I couldn't get it working on my Windows2000 development box.
Re: perl-based server for use by CGI scripts.
by Buggs (Acolyte) on Feb 21, 2002 at 04:10 UTC
    I'd go for the second solution as there are some glitches with sharing data inside Apache.
    For performance Apache uses more than one process (configurable via (Min|Max)SpareServers),
    these cannot easily share data.

    On the otherhand with HTTP::Daemon one can create a simple
    HTTP/1.1 (not all of HTTP/1.1 of course) webserver in less than 20 lines of code :)
    merlyn wrote some Http proxy servers with it.
    Or have a look at POE.
Re: perl-based server for use by CGI scripts.
by TippyTurtle (Novice) on Feb 23, 2002 at 00:37 UTC
    This sounds like a job for SOAP::Lite. It has SOAP::Transport::HTTP and SOAP::Apache (mod_perl) if you want to use that at some point, it also provides it own server if needed. I have used it for various remote email processing tasks and it seems fairly durable.
    There is a good article with a very simple example in the March 2001 Linux Journal.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-04-20 06:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found