Acme-CPANModulesBundle-Import-MojoliciousAdvent-2017
    
    
  
  
  
view release on metacpan or search on metacpan
devdata/https_mojolicious.io_blog_2017_12_08_day-8-mocking-a-rest-api view on Meta::CPAN
{ "status": "success", "id": 3, "server": { "ip": "10.0.0.3" } }
</code></pre>
<p>Now what if I want to test what happens when the API gives me an error?
Mojolicious has an easy way to layer on additional templates to use for
certain routes: <a href="http://mojolicious.org/perldoc/Mojolicious/Guides/Rendering#Template-variants">Template
variants</a>.
These variant templates will be used instead of the original template,
but only if they are available. Read more on <a href="/blog/2017/12/07/day-7-using-template-variants-for-a-beta-landing-page/">how to use template
variants yesterday on the advent
calendar</a>.</p>
<p>By setting the template variant to the application "mode", we can easily
switch between multiple sets of templates by adding <code>-m <mode></code> to the
command we run.</p>
<pre><code class="hljs"><span class="hljs-comment"># test-api.pl</span><span class="hljs-comment">
</span><span class="hljs-keyword">use</span> <span class="hljs-function">Mojolicious::Lite</span>;
any '<span class="hljs-string">/*path</span>' => <span class="hljs-keyword">sub </span>{
    <span class="hljs-keyword">my</span> ( <span class="hljs-type">$c</span> ) = <span class="hljs-type">@_</span>;
    <span class="hljs-keyword">return</span> <span class="hljs-type">$c</span>-><span class="hljs-type">render</span>(
devdata/https_mojolicious.io_blog_2017_12_21_day-21-virtually-a-lumberjack view on Meta::CPAN
<p>By logging the packets generated during each movement, we can compare the
content of each log to identify which bytes are related to which action. Such
movements include roll (tilting head side-to-side), pitch (looking up and
down) and yaw (turning left/right). Though position isn't tracked, we also
look for sway (left-right translation), surge (back and forth) and heave (up
and down) information as this is used in combination with the other values for
accurate tracking of rotation.</p>
<p>Mojo is an amazing toolkit for web development, as shown in previous
calendar entries, but using components of it can also solve problems in other
non-web spaces like these. Why use Mojo for this? Because it makes it <em>easy</em>.</p>
              </section>
              <section id="section-2">
                  <h2>Down By The Riverside</h2>
<p>First of all, we need the stream of data.
Initially, I used <code>tshark</code> for this, though another member of the OpenHMD team
built another application, OpenHMD-Dumper, which has both a device selection
interface and opens the device to read the packets, which makes this much
devdata/https_mojolicious.io_blog_2017_12_24_day-24-release-and-wrap-up view on Meta::CPAN
  <link href="/theme/css/default.css" rel="stylesheet">
  <link href="/theme/css/layout.css" rel="stylesheet">
  <link href="/theme/css/media-queries.css" rel="stylesheet">
  <link href="/theme/css/statocles.css" rel="stylesheet">
  <!-- twitter and opengraph -->
  <meta content="summary" name="twitter:card">
      <meta content="@joelaberger" name="twitter:creator">
  <meta content="https://mojolicious.io/blog/2017/12/24/day-24-release-and-wrap-up/" property="og:url">
  <meta content="Day 24: Release and Wrap-Up" property="og:title">
    <meta content="The Wishlist app is released to CPAN and a wrap-up for the advent calendar." property="og:description">
    <meta content="https://mojolicious.io/blog/2017/12/24/day-24-release-and-wrap-up/tree_unfocused.jpg" property="og:image">
    <meta content="summary_large_image" name="twitter:card">
  <script src="/theme/js/modernizr.js"></script>
      <link href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/sunburst.min.css" rel="stylesheet">
  <title>Day 24: Release and Wrap-Up - mojolicious.io</title>
  <meta content="Joel Berger" name="author">
  <meta content="Statocles 0.093" name="generator">
devdata/https_mojolicious.io_blog_2017_12_24_day-24-release-and-wrap-up view on Meta::CPAN
            </div>
              <div class="post-thumb">
                <!-- theme suggests 1300x500 -->
                <img alt="Out of focus image of lit Christmas tree" src="/blog/2017/12/24/day-24-release-and-wrap-up/tree_unfocused.jpg">
              </div>
            <div class="post-content">
              <section id="section-1">
                  <p>Over the course of this advent calendar, we have discussed the <a href="https://mojolicious.io/blog/tag/wishlist/">Wishlist example application</a> several times.
We used it to motivate discussions about <a href="/blog/2017/12/17/day-17-the-wishlist-app/">templates</a>, <a href="/blog/2017/12/18/day-18-the-wishlist-model/">models</a>, <a href="/blog/2017/12/19/day-19-make-your-app-installable/">installable app...
In this post I want to use it somewhat differently.
I would like to motivate you, the reader, into action in a few different ways.</p>
              </section>
              <section id="section-2">
                  <h3>The Double-Edged Sword</h3>
<p>The internet has made so many amazing things possible.
Old friendships are kept alive.
( run in 0.523 second using v1.01-cache-2.11-cpan-c333fce770f )