Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^4: Mojo 0.7 released (Perl on Rails in 150 lines of code)

by sri (Vicar)
on Oct 21, 2008 at 09:31 UTC ( #718426=note: print w/replies, xml ) Need Help??


in reply to Re^3: Mojo 0.7 released (Perl on Rails in 150 lines of code)
in thread Mojo 0.7 released (Perl on Rails in 150 lines of code)

->route will create a new route object, which has a method ->to that sets some attributes in the object.
There is no hidden magic and they should not touch parent or child routes, but default values (and captures) will be forwarded to child routes when matching a path.
# /foo my $x = $r->route('/foo')->to(controller => 'bar'); # /foo/* $x->route('/:action')->to(action => 'test');
This would be a nested route example where defaults and captures get forwarded. (controller => 'bar' in this case)

Replies are listed 'Best First'.
Re^5: Mojo 0.7 released (Perl on Rails in 150 lines of code)
by zby (Vicar) on Oct 21, 2008 at 10:12 UTC
    Nice. Although without the explanation I would read $x->route('/:action')->to(action => 'test'); as meaning that now everything would go to test. Even now I am not so sure if I understood it correctly - and that it only means that uris without a matching action part would end up there.
      Try not to think too complicated. :)
      It basically just passes around a hash that gets decorated with captures and/or defaults, thats it.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://718426]
help
Chatterbox?
[choroba]: create a ticket if the number of tickets reaches a limit
[choroba]: how deep meta could it go?
[marto]: this sounds like a sub section for Sane Dots
[Corion]: marto: You mean "Sane Dots Dramatic Reading of ITIL" ? ;)
[marto]: Sane Dots, chapter 13: ITIL never work :P
[marto]: sorry, bad pun of it'll :P

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (8)
As of 2017-01-24 10:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (203 votes). Check out past polls.