On Oct 25, 2006, at 9:48 PM, Will Fould wrote:
I've started testing a handler (configured at '/') that parses $r-
>uri and checks the object, doing a redirect accordingly, but this
seems wasteful for every hit.
I've thought about using the handler for only 404...
Personally, i use a dispatch table and dispatch regex system --
sample organization code below
i see if a stripped uri is in the dispatch, if its not i loop/recurse
regex trees looking for matches/better matches
if i get nothing, then i go 404
the static and regex lookups are negligible. i think they're like
1/50000 seconds, or soemthing ridiculously fast like that on my
slowest box
========
use constant URL_Dispatch=> {
'/'=> 'FindMeOn::Syndicate::Base::Default',
'_default'=> 'FindMeOn::Syndicate::Base::Default',
'/findmeon/visit/'=> 'FindMeOn::Syndicate::Base::Findmeon::Visit',
};
use constant URL_RegexDispatch=> [
{
regex=> qr/^\/findmeon\//,
sections=> [
# findmeon-embeds , links
{
'regex' =>
qr/^\/findmeon\/findmeons\/([\w]{32})\/v1(:?\/)?$/,
'package' =>
'FindMeOn::Syndicate::Base::Findmeon::Findmeons::v1',
'id_fields'=> ['hex_id']
},
}
];
// Jonathan Vanasco
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
| FindMeOn.com - The cure for Multiple Web Personality Disorder
| Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
| RoadSound.com - Tools For Bands, Stuff For Fans
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -