Router...Declare(3pm)

πŸ¦‹ Router::Simple::Declare(3pm) πŸ¦‹

User Contributed Perl Documentation β€” yeah bestie, this is one of the community-written ones πŸ’–


✨ NAME ✨

Router::Simple::Declare β€” the declarative interface for Router::Simple. it's giving "just tell me the routes, don't make me write a million method calls" πŸ’…


🌸 SYNOPSIS 🌸

use Router::Simple::Declare;

my $router = router {
    connect '/{controller}/{action}/{id}';

    submapper('/account', {controller => 'Account'})
        ->connect('/login', {action => 'login'})
        ->connect('/logout', {action => 'logout'});
};
$router->match('/entry/show/3');

okay so look at this 🫢 you set up the whole router inside one router { ... } block, you connect your routes, you chain submapper calls together like a little daisy chain of routing goodness, and then $router->match(...) does its thing. iconic behaviour, no cap πŸ”₯


πŸŽ€ DESCRIPTION πŸŽ€

Literally the easy way to declare a router object ✨ that's it, that's the description. lowkey perfect.


πŸ’œ USAGE πŸ’œ

Go look at the SYNOPSIS up there, bestie πŸ‘€ that's the whole usage. And see Router::Simple for more deets β€” that's where the real lore lives πŸ“š


πŸ‘‘ FUNCTIONS πŸ‘‘

The cast of characters, in the order the page lists them:

  • router
  • connect
  • submapper

that's the lineup 🎀 the manpage keeps it mystery-girl short here, so treat the SYNOPSIS as your source of truth πŸ’–


🌈 SEE ALSO 🌈

  • Router::Simple β€” the main character, go read it 🧚

and that's a wrap, bestie!! πŸŽ‰ this lil page came to you courtesy of the User Contributed Perl Documentation crew, with a source/version vibe of perl v5.42.0 and a timestamp of 2015-04-13 πŸ“ mwah, go build some routes πŸ’‹βœ¨

πŸ“¦ where this page comes from