On Aug 1, 2006, at 10:45 AM, John ORourke wrote:
Excellent, I'd never heard of that. I only found out about
Class::DBI yesterday too - next thing you'll be telling me there's
a guide that picks out the most useful CPAN modules to stop people
reinventing the wheel!
Personally, I disliked the dispatch frameworks out there. They did
things I didn't like, didn't do things I needed, and were too hard to
patch.
So naturally, I made my own wheel -- and it has killer rims.
Its not terribly difficult to roll your own inspired from what you
like in the stuff out there.
My handler has a few config items like:
my %URL_Dispatch= (
'/'=> 'FindMeOn::Page::Core::Index',
);
my @URL_RegexDispatch= (
# user main , by numeric id
{
'regex'=> qr/^\/user\/([\w]{10})[\/]?$/,
'package'=> 'FindMeOn::Page::Core::User::Main',
'id_fields'=> ['hex_id']
},
);
Then I just parse the path , clean it up, and map it onto a module
using a Page/Dispatch module i wrote.
The regex suff is damn inefficient right now. I'm just looping an
array. I need to update it to do a hierarchy to be limit my match
pool- but its still pretty decent and works for me better than the
other dispatch stuff out there.
FWIW, I'd suggest checking out Rose::DB::Object over Class::DBI - its
not only much nicer to work with from the outset, but its easy to
implement over an existing project.