JFDI

jesse on 2005-04-29T08:57:44

I finally got around to starting to code on the new project. I found myself attempting to extract a whole bunch of RT to use here, since it'll all be so much easier if I just have the framework I already wrote. I really need to take a page from the guys at 37signals and spend a bit of time pulling the RT framework out of this ticketing sytem I've got. Internationalization, Robust mail handling, database setup, installation, authentication, authorization and a few more things really deserve to be in an external framework. Even if it's a framework that only works with DBIx::SearchBuilder and Mason.

But I've started. RT's standalone_httpd is now HTTP::Server::Simple and HTTP::Server::Simple::Mason.

It's easy.

#!/usr/bin/env perl use warnings; use strict; JFDI::Server->new(13432)->run;

package JFDI::Server; use base qw/HTTP::Server::Simple::Mason/; use FindBin;

sub mason_config { return ( comp_root => "$FindBin::Bin/../templates"); }


Re:

Aristotle on 2005-04-30T00:20:35

As always, note that FindBin is broken.

Re:

jesse on 2005-05-02T20:12:24

Except it's fine for this use. Or rather, that article doesn't explain to me why findbin is broken. It just says "it doesn't do this other thing I want it to do"

Re:

Aristotle on 2005-05-02T20:30:26

Because it searches your $PATH for basename $0 with possibly unexpected results. And makes a lot of other assumptions. Just read the entire POD; it’s full of caveats. basename rel2abs $0 before changing any directories OTOH is much very unlikely to surprise you.