It's not PHP, is it? (potential new CPAN module)

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View


I'm working on a Perlish web server.  Have a bit of history:  I once had
a job where we used PHP.  It was okay, but I felt it wasn't a real
programming language.  At my new job, we use Perl.  I like using Perl.

When I write something in Perl, I notice things in my code I'm not used
to seeing.  Some of these things are ugly, and when I try to figure out
why they look bad, I usually find that I've done something wrong.  Being
a perfectionist, I like that.

The codebase at work is ugly.  It's basically MVC, a lot of it is
spaghetti, and it's all very VERY crufty.  We have a core .pm that's
almost 1/2MB.  It could "easily" be split into at least 5 simpler modules.

So I'm writing a Perlish web server in hopes of moving the whole site
over.  Maybe the server is Colin-ish, but I'm writing it in Perl with
the intent of making it Perlish.  Here's the basic idea:  the server
(running in a persistent Perl interpreter) receives a request and begins
validating it.  It determines whether the requested file is dynamic
(currently by checking -x), eval()s it if so, and sends it if not.

Some more details:

It currently only works under mod_perl2, but there's a Driver superclass
that should let us use any server.

It's name (at the moment) is SDH (Simple Dynamic Hypertext), because I
like TLAs and that one is only used once in technology (that I know of).
  In medicine, it means "subdural hematoma," which I find amusing, if

I like parentheses.

I "came up with" this weird (to me) 3-stage configuration system. require()s, which sets $SDHConf::srv_root.  This
variable is used to find conf.yml, which contains the static
configuration, including the parameters to pass to DBI::connect() so
that we can get the dynamic configuration.

So I present an essay question.  I expect your essays on my desk by 8 AM
Monday.  ;-)

Should this become a CPAN module?  Is there anyone around who is
particularly good at style proofing, documenting, and testing, or am I
going to have to buy a big pile of tuits?


Re: It's not PHP, is it? (potential new CPAN module)

cvm Errata

I seem to have flamed the crap out of my boss in paragraph 3.  To be
fair to him, I'll point out that he's been the only developer until this

"Why not just use CGI?"  I have two reasons.  First, CGI uses some odd
conventions that I find too limiting.  Second, CGI starts a new Perl
interpreter for each request.  I'd rather run the risk of polluting the
interpreter and get the extra performance.

It looks like I didn't proof the last 2 paragraphs of my message.
Whoops.  They still mean what I meant, though.

I forgot to ask:  Is there an existing root-level namespace I should use
for this?  I've heard grumblings about all-caps module names.  Is SDH
going to be a problem?  How about Apps::SDH (or whatever namespace comes
out of the first question)?  (I ask because I've read grumblings about
package names that are all- or no-caps.)


Re: It's not PHP, is it? (potential new CPAN module)

Colin von Heuring wrote:

Hi Colin

CPAN is your friend. There are various Perl modules /already written/
which implement web servers. Go to:
and search for, say, http, and you'll find HTTP::Server::Simple for one.
Don't forget to also search for cgi::application, where you'll find
CGI::Application (hint, hint) and CGI::Application::Server.

Site Timeline