Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^5: I LOVE PLACK!!!!

by Logicus
on Sep 03, 2011 at 14:08 UTC ( #923991=note: print w/replies, xml ) Need Help??


in reply to Re^4: I LOVE PLACK!!!!
in thread I LOVE PLACK!!!!

Yeh, I had a play with mojolicious::lite a few weeks ago, just before I wrote Slang. It seems pretty funky, but one question I had was what if there are dozens or hundreds of routes?

Typically the way I organise things my routes are laid out using the filesystem;

default
usercp
usercp/password
usercp/password/forgotten
usercp/password/reset
etc...

It appears that under mojo you have to create a route in the program for each one and I can see that becoming quite unwieldy quite quickly for the size of apps I tend to build.

Is there a way around that? I haven't looked into it enough to be sure.

Replies are listed 'Best First'.
Re^6: I LOVE PLACK!!!!
by davido (Archbishop) on Sep 03, 2011 at 16:07 UTC

    Routes can have wildcards at any position. So userca/password and usercb/password and usercd/password could all be one route with different users. What you do with the portion of the route that fills the wildcard is up to you. You could, for example, let your program logic deal with wildcards at the /forgotten and /reset level, or you could let routes send them to different models. In other words, you do have control over whether the routes lead to a destination or to logic. I'm sure I'm not being clear (have a cold that seems to put my head in a fog), but look at Mojolicious::Guides::Routing for examples.


    Dave

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://923991]
help
Chatterbox?
[Discipulus]: floating was the keyword and.. to use supersearch is plus sign not a (plus) sin
Discipulus wonders if just numbers less than 18 are really floating..( chemical humor)
[Lady_Aleena]: Hello.
[Discipulus]: ciao Lady_Aleena

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2017-06-26 21:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (594 votes). Check out past polls.