Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I think the Perl web framework with most Rails-like routing would be <a href="http://mojolicious.org/" rel="nofollow noreferrer"><code>Mojolicious</code></a></p> <p>The creator of <a href="http://mojolicious.org/" rel="nofollow noreferrer"><code>Mojolicious</code></a> did write an excellent blog post called "Dispatchers for dummies" comparing the major Perl, Ruby &amp; Python web frameworks and highlighting what he believed were improvements he made with routing on <a href="http://mojolicious.org/" rel="nofollow noreferrer"><code>Mojolicious</code></a>. </p> <p>Unfortunately above post is no longer online :( Instead you have to settle for the <a href="http://search.cpan.org/dist/Mojolicious/lib/Mojolicious/Guides/Routing.pod" rel="nofollow noreferrer"><code>Mojolicious::Guides::Routing</code></a> documentation. Here is a routing example from the docs:</p> <pre><code>package MyApp; use base 'Mojolicious'; sub startup { my $self = shift; # Router my $r = $self-&gt;routes; # Route $r-&gt;route('/welcome')-&gt;to(controller =&gt; 'foo', action =&gt; 'welcome'); } 1; </code></pre> <p><br> There are also other Perl frameworks which provide direct URL to action routing:</p> <ul> <li><a href="http://jifty.org" rel="nofollow noreferrer"><code>Jifty</code></a> (uses a nice <a href="http://search.cpan.org/dist/Jifty/lib/Jifty/Dispatcher.pm" rel="nofollow noreferrer">routing DSL</a>)</li> <li><a href="http://perldancer.org/" rel="nofollow noreferrer"><code>Dancer</code></a> (Ruby <a href="http://www.sinatrarb.com/" rel="nofollow noreferrer">Sinatra</a>-like)</li> <li><a href="http://search.cpan.org/dist/Mojolicious/lib/Mojolicious/Lite.pm" rel="nofollow noreferrer"><code>Mojolicious::Lite</code></a> (ditto)</li> <li><a href="http://search.cpan.org/dist/Squatting/" rel="nofollow noreferrer"><code>Squatting</code></a> (inspired by Ruby <a href="http://www.ruby-camping.com/" rel="nofollow noreferrer">Camping</a>)</li> <li><a href="http://search.cpan.org/dist/Web-Simple/lib/Web/Simple.pm" rel="nofollow noreferrer"><code>Web::Simple</code></a></li> </ul> <p>A more complete list of <a href="http://www.perlfoundation.org/perl5/index.cgi?web_frameworks" rel="nofollow noreferrer">Perl web frameworks</a> can be found on the <a href="http://www.perlfoundation.org/perl5/" rel="nofollow noreferrer">Perl5 wiki</a></p> <p><br> And if you are framework adverse then take a look at <a href="http://plackperl.org/" rel="nofollow noreferrer"><code>Plack</code></a> (<sup><sub>also see <a href="http://en.wikipedia.org/wiki/PSGI" rel="nofollow noreferrer">PSGI</a> wikipedia)</sub></sup>. This is same as <a href="http://rack.rubyforge.org/" rel="nofollow noreferrer">Rack</a> on Ruby and <a href="http://en.wikipedia.org/wiki/Web_Server_Gateway_Interface" rel="nofollow noreferrer">WSGI</a> on Python.</p> <p>Here is a quick and dirty example of Plack:</p> <pre><code>use 5.012; use warnings; my $app = sub { my $env = shift; given ($env-&gt;{PATH_INFO}) { return [ 200, [ 'Content-Type' =&gt; 'text/plain' ], [ 'Hello Baz!' ] ] when '/hello/baz'; default { return [ 200, [ 'Content-Type' =&gt; 'text/plain' ], [ 'Hello World' ]]; } } } </code></pre> <p>Then use <code>plackup above_script.psgi</code> and away you go.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload