view release on metacpan or search on metacpan
devdata/http_advent.perldancer.org_2018_13 view on Meta::CPAN
</head>
<body onload="prettyPrint()">
<div id="page">
<div id="sidebar">
<a href="/" class="homelink">Dancer Advent Calendar</a><br />
<p>
The PerlDancer Advent Calendar is a community-driven project that aims
to showcase the Dancer Perl web framework.
</p>
<p>
Each day of December until Christmas, one article about Dancer. Stay tuned for new moves!
</p>
<ul id="sidebar-items">
<li>
<h3>About Dancer</h3>
<ul class="links">
devdata/http_advent.perldancer.org_2018_13 view on Meta::CPAN
<div id="content">
<div class="pod-document"><h1><a name="the_twelve_days_of_dancer"></a>The Twelve Days of Dancer</h1>
<p>Hello and goodbye, 2018! It seems like we hardly knew you. It's been a few
years since our last calendar, and while everyone here is busy with other
projects, we still wanted to give you a mini-advent-calendar this year.
Welcome to the Twelve Days of Dancer!</p>
<p>This year's calendar features twelve posts that cover a wide range of topics.
We feature several new authors, cover some new ground (for us!) with an
article on accessibility, and even have a crossover post showing how Dancer
can be used with other frameworks.</p>
<p>Without further ado, let's dance!</p>
<h2><a name="state_of_the_dancer"></a>State of the Dancer</h2>
<p>In 2017 and 2018, we saw fewer but more significant updates to Dancer and
Dancer2. With Dancer (1) being in maintenance mode, updates come only when
significant bugs are found, security vulnerabilities are found, or when a
change is proposed that greatly improve the lives of Dancer developers.
David Precious has been the light that guides Dancer(1) through the night,
and has been an excellent resource for both the Dancer and Dancer2 communities
on IRC and email.</p>
devdata/http_advent.perldancer.org_2018_13 view on Meta::CPAN
</div>
<div id="footer">
Powered by the
<a href="http://perldancer.org/" title="Perl Dancer - Perl web framework">
Dancer Perl web framework</a>
</div>
</div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25174467-2']);
_gaq.push(['_trackPageview']);
devdata/http_advent.perldancer.org_2018_14 view on Meta::CPAN
</head>
<body onload="prettyPrint()">
<div id="page">
<div id="sidebar">
<a href="/" class="homelink">Dancer Advent Calendar</a><br />
<p>
The PerlDancer Advent Calendar is a community-driven project that aims
to showcase the Dancer Perl web framework.
</p>
<p>
Each day of December until Christmas, one article about Dancer. Stay tuned for new moves!
</p>
<ul id="sidebar-items">
<li>
<h3>About Dancer</h3>
<ul class="links">
devdata/http_advent.perldancer.org_2018_14 view on Meta::CPAN
<li><a name="item_Be_more_community_active"></a><b>Be more community active</b>
<p>This last item refers to the core team being more active on Stack Overflow, Perl Monks, and the like. To the best of our abilities, we will
try to do so!</p>
</li>
</ul>
<p>This comment in particular stood out to me:</p>
<pre class="prettyprint">"More tutorials. Especially about deployment. I believe the greatest
hurdle for new developers (as in new new, who start doing web stuff
in Perl, or programming in general, with Dancer) is not to get started,
but to get done. There is a lot of good content in all the major
frameworks in the Perl ecosystem on how to build an application, but
all of them lack in-depth tutorials with different alternatives for how
to deploy them. This includes telling inexperienced users what hosting a
web application means, what the different deployment types with PSGI do
and which one to pick. I think having a really good guide would set
Dancer apart from other frameworks."</pre>
<p>This is certainly one area we have set out to improve in the documentation.</p>
<h2><a name="cool_uses_of_dancer"></a>Cool uses of Dancer</h2>
<p>Our users shared with us some of the cool things they have done with Dancer.
I'm considering doing some writeups on the Dancer website about some of them:</p>
<ul>
<li><a name="item_Service_monitoring_dashboard"></a><b>Service monitoring dashboard</b>
</li>
<li><a name="item_VOIP_provisioning_app"></a><b>VOIP provisioning app</b>
devdata/http_advent.perldancer.org_2018_14 view on Meta::CPAN
</div>
<div id="footer">
Powered by the
<a href="http://perldancer.org/" title="Perl Dancer - Perl web framework">
Dancer Perl web framework</a>
</div>
</div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25174467-2']);
_gaq.push(['_trackPageview']);
devdata/http_advent.perldancer.org_2018_15 view on Meta::CPAN
</head>
<body onload="prettyPrint()">
<div id="page">
<div id="sidebar">
<a href="/" class="homelink">Dancer Advent Calendar</a><br />
<p>
The PerlDancer Advent Calendar is a community-driven project that aims
to showcase the Dancer Perl web framework.
</p>
<p>
Each day of December until Christmas, one article about Dancer. Stay tuned for new moves!
</p>
<ul id="sidebar-items">
<li>
<h3>About Dancer</h3>
<ul class="links">
devdata/http_advent.perldancer.org_2018_15 view on Meta::CPAN
template 'list', { paginator => $paginator };
};
true;</pre>
<h2><a name="configuration"></a>CONFIGURATION</h2>
<p>To bring the above example live, we need to tune the configuration slightly as below.</p>
<pre class="prettyprint">plugins:
Paginator:
frame_size: 3
page_size: 7</pre>
<h2><a name="real_hands_on"></a>REAL HANDS-ON</h2>
<p>Having seen the details, now let us try real example. I have got GitHub repository that I use to try new things related to Dancer2 i.e. <a href="https://github.com/manwar/Dancer2-Cookbook">Dancer2 Cookbook</a>. You should find a link "Books" showi...
<h3><a name="example_configuration"></a>Example Configuration</h3>
<pre class="prettyprint">plugins:
Paginator:
frame_size: 1
page_size: 3</pre>
<h3><a name="action"></a>Action</h3>
<pre class="prettyprint">get '/books/:page' => sub {
my $books = _books();
my $curr = params->{page} || 1;
template 'books' => _paginator($books, $curr);
};
devdata/http_advent.perldancer.org_2018_15 view on Meta::CPAN
</div>
<div id="footer">
Powered by the
<a href="http://perldancer.org/" title="Perl Dancer - Perl web framework">
Dancer Perl web framework</a>
</div>
</div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25174467-2']);
_gaq.push(['_trackPageview']);
devdata/http_advent.perldancer.org_2018_16 view on Meta::CPAN
</head>
<body onload="prettyPrint()">
<div id="page">
<div id="sidebar">
<a href="/" class="homelink">Dancer Advent Calendar</a><br />
<p>
The PerlDancer Advent Calendar is a community-driven project that aims
to showcase the Dancer Perl web framework.
</p>
<p>
Each day of December until Christmas, one article about Dancer. Stay tuned for new moves!
</p>
<ul id="sidebar-items">
<li>
<h3>About Dancer</h3>
<ul class="links">
devdata/http_advent.perldancer.org_2018_16 view on Meta::CPAN
</div>
<div id="footer">
Powered by the
<a href="http://perldancer.org/" title="Perl Dancer - Perl web framework">
Dancer Perl web framework</a>
</div>
</div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25174467-2']);
_gaq.push(['_trackPageview']);
devdata/http_advent.perldancer.org_2018_17 view on Meta::CPAN
</head>
<body onload="prettyPrint()">
<div id="page">
<div id="sidebar">
<a href="/" class="homelink">Dancer Advent Calendar</a><br />
<p>
The PerlDancer Advent Calendar is a community-driven project that aims
to showcase the Dancer Perl web framework.
</p>
<p>
Each day of December until Christmas, one article about Dancer. Stay tuned for new moves!
</p>
<ul id="sidebar-items">
<li>
<h3>About Dancer</h3>
<ul class="links">
devdata/http_advent.perldancer.org_2018_17 view on Meta::CPAN
</div>
<div id="footer">
Powered by the
<a href="http://perldancer.org/" title="Perl Dancer - Perl web framework">
Dancer Perl web framework</a>
</div>
</div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25174467-2']);
_gaq.push(['_trackPageview']);
devdata/http_advent.perldancer.org_2018_18 view on Meta::CPAN
</head>
<body onload="prettyPrint()">
<div id="page">
<div id="sidebar">
<a href="/" class="homelink">Dancer Advent Calendar</a><br />
<p>
The PerlDancer Advent Calendar is a community-driven project that aims
to showcase the Dancer Perl web framework.
</p>
<p>
Each day of December until Christmas, one article about Dancer. Stay tuned for new moves!
</p>
<ul id="sidebar-items">
<li>
<h3>About Dancer</h3>
<ul class="links">
devdata/http_advent.perldancer.org_2018_18 view on Meta::CPAN
</div>
<div id="footer">
Powered by the
<a href="http://perldancer.org/" title="Perl Dancer - Perl web framework">
Dancer Perl web framework</a>
</div>
</div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25174467-2']);
_gaq.push(['_trackPageview']);
devdata/http_advent.perldancer.org_2018_19 view on Meta::CPAN
</head>
<body onload="prettyPrint()">
<div id="page">
<div id="sidebar">
<a href="/" class="homelink">Dancer Advent Calendar</a><br />
<p>
The PerlDancer Advent Calendar is a community-driven project that aims
to showcase the Dancer Perl web framework.
</p>
<p>
Each day of December until Christmas, one article about Dancer. Stay tuned for new moves!
</p>
<ul id="sidebar-items">
<li>
<h3>About Dancer</h3>
<ul class="links">
devdata/http_advent.perldancer.org_2018_19 view on Meta::CPAN
</div>
<div id="footer">
Powered by the
<a href="http://perldancer.org/" title="Perl Dancer - Perl web framework">
Dancer Perl web framework</a>
</div>
</div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25174467-2']);
_gaq.push(['_trackPageview']);
devdata/http_advent.perldancer.org_2018_20 view on Meta::CPAN
</head>
<body onload="prettyPrint()">
<div id="page">
<div id="sidebar">
<a href="/" class="homelink">Dancer Advent Calendar</a><br />
<p>
The PerlDancer Advent Calendar is a community-driven project that aims
to showcase the Dancer Perl web framework.
</p>
<p>
Each day of December until Christmas, one article about Dancer. Stay tuned for new moves!
</p>
<ul id="sidebar-items">
<li>
<h3>About Dancer</h3>
<ul class="links">
devdata/http_advent.perldancer.org_2018_20 view on Meta::CPAN
->send_ok({json => {hello => 'Dancer'}})
->message_ok
->json_message_is({hello => 'browser!'})
->finish_ok;
done_testing;</pre>
<p>Unlike the previous examples, this time the connection stays open (but blocked) between method calls.
Per the protocol of the example, we first send a greeting to the Dancer app as a JSON document.
Since so much real-world websocket usage is just serialized JSON messages, Mojolicious provides many JSON-over-WebSocket conveniences.
One such convenience is a virtual websocket frame type that takes a data structure and serializes it as JSON before actually sending it as a text frame.</p>
<p>We then wait to get a message in response with <code>message_ok</code>.
In this case, we expect the application to greet us by calling us "browser!".
Oh well, it doesn't know any better!
We can the test that JSON reply with <code>json_message_is</code> (like <code>json_is</code> above but for websocket messages).
Finally we close the connection, testing that it closes correctly.</p>
<p>Testing WebSockets, even from a Dancer application, is easy!</p>
<h2><a name="conclusion"></a>Conclusion</h2>
<p>Although there are some great testing options in the PSGI space, Test::Mojo has lots of benefits for Dancer and PSGI users.
By using Test::Mojo::Role::PSGI or by running against a locally-bound server, Test::Mojo can be a tool in the toolbox of any PSGI developer.</p>
devdata/http_advent.perldancer.org_2018_20 view on Meta::CPAN
</div>
<div id="footer">
Powered by the
<a href="http://perldancer.org/" title="Perl Dancer - Perl web framework">
Dancer Perl web framework</a>
</div>
</div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25174467-2']);
_gaq.push(['_trackPageview']);
devdata/http_advent.perldancer.org_2018_21 view on Meta::CPAN
</head>
<body onload="prettyPrint()">
<div id="page">
<div id="sidebar">
<a href="/" class="homelink">Dancer Advent Calendar</a><br />
<p>
The PerlDancer Advent Calendar is a community-driven project that aims
to showcase the Dancer Perl web framework.
</p>
<p>
Each day of December until Christmas, one article about Dancer. Stay tuned for new moves!
</p>
<ul id="sidebar-items">
<li>
<h3>About Dancer</h3>
<ul class="links">
devdata/http_advent.perldancer.org_2018_21 view on Meta::CPAN
</div>
<div id="footer">
Powered by the
<a href="http://perldancer.org/" title="Perl Dancer - Perl web framework">
Dancer Perl web framework</a>
</div>
</div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25174467-2']);
_gaq.push(['_trackPageview']);
devdata/http_advent.perldancer.org_2018_22 view on Meta::CPAN
</head>
<body onload="prettyPrint()">
<div id="page">
<div id="sidebar">
<a href="/" class="homelink">Dancer Advent Calendar</a><br />
<p>
The PerlDancer Advent Calendar is a community-driven project that aims
to showcase the Dancer Perl web framework.
</p>
<p>
Each day of December until Christmas, one article about Dancer. Stay tuned for new moves!
</p>
<ul id="sidebar-items">
<li>
<h3>About Dancer</h3>
<ul class="links">
devdata/http_advent.perldancer.org_2018_22 view on Meta::CPAN
</div>
<div id="footer">
Powered by the
<a href="http://perldancer.org/" title="Perl Dancer - Perl web framework">
Dancer Perl web framework</a>
</div>
</div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25174467-2']);
_gaq.push(['_trackPageview']);
devdata/http_advent.perldancer.org_2018_23 view on Meta::CPAN
</head>
<body onload="prettyPrint()">
<div id="page">
<div id="sidebar">
<a href="/" class="homelink">Dancer Advent Calendar</a><br />
<p>
The PerlDancer Advent Calendar is a community-driven project that aims
to showcase the Dancer Perl web framework.
</p>
<p>
Each day of December until Christmas, one article about Dancer. Stay tuned for new moves!
</p>
<ul id="sidebar-items">
<li>
<h3>About Dancer</h3>
<ul class="links">
devdata/http_advent.perldancer.org_2018_23 view on Meta::CPAN
</div>
<div id="footer">
Powered by the
<a href="http://perldancer.org/" title="Perl Dancer - Perl web framework">
Dancer Perl web framework</a>
</div>
</div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25174467-2']);
_gaq.push(['_trackPageview']);
devdata/http_advent.perldancer.org_2018_24 view on Meta::CPAN
</head>
<body onload="prettyPrint()">
<div id="page">
<div id="sidebar">
<a href="/" class="homelink">Dancer Advent Calendar</a><br />
<p>
The PerlDancer Advent Calendar is a community-driven project that aims
to showcase the Dancer Perl web framework.
</p>
<p>
Each day of December until Christmas, one article about Dancer. Stay tuned for new moves!
</p>
<ul id="sidebar-items">
<li>
<h3>About Dancer</h3>
<ul class="links">
devdata/http_advent.perldancer.org_2018_24 view on Meta::CPAN
</div>
<div id="footer">
Powered by the
<a href="http://perldancer.org/" title="Perl Dancer - Perl web framework">
Dancer Perl web framework</a>
</div>
</div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25174467-2']);
_gaq.push(['_trackPageview']);