[Catalyst] C::Manual::Intro.pm docs patch

Matt S Trout dbix-class at trout.me.uk
Sun Feb 19 17:34:22 CET 2006


On Sun, Feb 19, 2006 at 05:01:14PM +0100, Thomas Hartman wrote:
> " If the action is a Regex or LocalRegex, the '$' anchor
> +must be used. "
> 
> That makes it sound like only the dollar must be used, but not the ^
> anchor. In the original version, both anchors were supposed to be
> used.
> 
> Is it correct that only the dollar matters to identify it as a regex action?

Neither, actually, but you *usually* want to do both. The behaviour is -

:Regex('foo') - matches any URL containing 'foo'. you don't want this.

:Regex('foo$') - matches any URL ending in 'foo'. you probably don't want this.

:Regex('^foo') - matches any URL starting in foo. ^foo/ would be relatively
  similar in behaviour to :Path('/foo'), I think

LocalRegex is generally a bit more useful  (assuming MyApp::C::Blah) -

:LocalRegex('foo') - would match /blah/.*foo.* - probably still not good

:LocalRegex('^foo') - would match /blah/foo.* - maybe useful

:LocalRegex('^foo$') - very similar to :Path('foo')

Or something along those lines. Just because I (re-)wrote the code that
currently handles this stuff doesn't mean I remember it entirely accurately ;)

-- 
     Matt S Trout       Offering custom development, consultancy and support
  Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

 + Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Catalyst mailing list