Acme-CPANModulesBundle-Import-PerlDancerAdvent-2018
view release on metacpan or search on metacpan
devdata/http_advent.perldancer.org_2018_14 view on Meta::CPAN
<li><a name="item_Quality_of_documentation"></a><b>Quality of documentation</b>
</li>
<li><a name="item_Stability"></a><b>Stability</b>
</li>
</ul>
<h2><a name="common_reasons_for_not_recommending"></a>Common reasons for not recommending</h2>
<ul>
<li><a name="item_Documentation"></a><b>Documentation</b>
</li>
<li><a name="item_Plugin_selection"></a><b>Plugin selection</b>
<p>While we've seen the addition of some new plugins recently (for websockets,
Log4perl, and CHI, among others), we would love to see more.</p>
</li>
<li><a name="item_Negative_public_perception_of_Perl"></a><b>Negative public perception of Perl</b>
<p>This is a hard problem to solve, and not one that is going to be solved by us alone.</p>
</li>
</ul>
<h2><a name="areas_of_improvement_things_to_improve"></a>Areas of improvement/things to improve</h2>
<p>There were some things that our community were anxious to see improved. I've listed items that came up multiple times:</p>
devdata/http_advent.perldancer.org_2018_20 view on Meta::CPAN
->content_type_like(qr[text/html])
->text_is('dl#data dt#hello + dd', 'world');
$t->post_ok('/html' => form => { name => 'grinch' })
->status_is(200)
->content_type_like(qr[text/html])
->text_is('dl#data dt#hello + dd', 'grinch');
done_testing;</pre>
<p>In this year's Mojolicious advent calendar, we've already seen <a href="https://mojolicious.io/blog/2018/12/05/compound-selectors/">some</a> <a href="https://mojolicious.io/blog/2018/12/14/a-practical-example-of-mojo-dom/">great</a> <a href="https...
The point remains however, testing HTML responses with CSS selectors allows you to make your tests targetd in a way that allows you to write more and better tests since you don't have to hack around extracting the bits you want.</p>
<h2><a name="testing_websockets"></a>Testing WebSockets</h2>
<p>Ok so that's great and all, but of course now it comes to the point you've all been waiting for: can you test WebSockets?
As Jason Crome mentioned in his <a href="http://advent.perldancer.org/2018/13">Twelve Days of Dancer</a> "State of Dancer", you can now dance with WebSockets via <a href="https://metacpan.org/pod/Dancer2::Plugin::WebSocket">Dancer2::Plugin::WebSocket...
<p>Well, so far not via the role I showed above.
It might be possible, but it would involve learning deep PSGI magick that I'm not sure I'm smart enough to do; patches welcome obviously :D.</p>
<p>Still I mentioned above that Test::Mojo can test anything it can access via an fully qualified URL, so let's just start up a server and test it!
I'll use the <a href="https://github.com/yanick/Dancer2-Plugin-WebSocket/tree/releases/example">example bundled with the plugin</a> for simplicty.</p>
<pre class="prettyprint">use Mojo::Base -strict;
( run in 0.957 second using v1.01-cache-2.11-cpan-49f99fa48dc )