Acme-CPANModulesBundle-Import-MojoliciousAdvent-2018

 view release on metacpan or  search on metacpan

devdata/https_mojolicious.io_blog_2018_12_06_making-a-list-with-yancy_  view on Meta::CPAN


<p><img alt="A browser window showing the completed webapp. A set of rows with name
and address on the left, and a Delivered button with Yes and No options
on the right.  Some rows have the No button checked, others the Yes
button" src="finished-screenshot.png"></p>

<p>We can view our entire list, and check off the ones who we&#39;ve delivered to already!
<a href="myapp.pl">View the entire app here</a>.</p>

<p><img alt="Santa Robot in his sleigh with burning buildings in the foreground and
background" src="success.png"></p>

<p>Another successful Xmas, powered by <a href="http://mojolicious.org">Mojolicious</a>!</p>

              </section>
              <small><p><a href="https://pxhere.com/en/photo/1263707">Banner image</a> CC0 Public Domain</p>
</small>

              <p class="tags">
                <span>Tagged in </span>:
                  <a href="/blog/tag/advent/">advent</a>,

devdata/https_mojolicious.io_blog_2018_12_09_add-a-theme-system-to-your-mojolicious-app_  view on Meta::CPAN

$self-&gt;static-&gt;paths([$self-&gt;home-&gt;rel_file(&#39;themes/default/public&#39;)]);
# Put the new theme first
unshift @{$self-&gt;renderer-&gt;paths}, $self-&gt;home-&gt;rel_file(&#39;themes/christmas/templates&#39;);
unshift @{$self-&gt;static-&gt;paths},   $self-&gt;home-&gt;rel_file(&#39;themes/christmas/public&#39;);
</code></pre>

<p>By doing that way, we can overload the default files.</p>

<p>You don&#39;t have to modify each file of the default theme to have a new theme: just copy the files you want to overload in your new theme directory and it will be used instead of the default one.</p>

<p>Let&#39;s say that you have a <code>background.png</code> file in your default theme:</p>

<pre><code>$ cd themes/default
$ tree public templates
public
├── background.png
└── index.html
templates
├── example
│   └── welcome.html.ep
└── layouts
    └── default.html.ep

2 directories, 4 files
</code></pre>

<p>In order to overload it, you just have to have this:</p>

<pre><code>$ cd themes/christmas
$ tree public templates
public
└── background.png
templates

0 directories, 1 files
</code></pre>

<h2>Using Mojolicious::Plugin::Config plugin</h2>

<p><a href="https://mojolicious.org/perldoc/Mojolicious/Plugin/Config">Mojolicious::Plugin::Config</a> comes with Mojolicious itself and is a great way to let users configure your application.
Why not using it to let them choose the theme they want?
In our example, the setting will unsurprisingly be named <code>theme</code>.</p>

devdata/https_mojolicious.io_blog_2018_12_12_dancer-and-minion_  view on Meta::CPAN


              <div class="post-thumb">
                <!-- theme suggests 1300x500 -->
                <img alt="Stylistic photograph of Disney-style minion toys" src="/blog/2018/12/12/dancer-and-minion/banner.jpg">
              </div>

            <div class="post-content">

              <section id="section-1">
                  <p>At <code>$work</code>, we have built an API with <a href="https://metacpan.org/pod/Dancer">Dancer</a> that generates PDF documents and XML files. This API is a critical component of an insurance enrollment system: PDFs are genera...
immediately, and the XML is delivered to the carrier as soon as it becomes available. Since the XML often takes a significant amount of time to generate, the job is generated in the background so as not to tie up the
application server for an extended amount of time. When this was done, a homegrown process management system was developed, and works by <code>fork()</code>ing a process, tracking its pid, and hoping we can later successfully
reap the completed process.</p>

<p>There have been several problems with this approach:
- it&#39;s fragile
- it doesn&#39;t scale
- it&#39;s too easy to screw something up as a developer</p>

<p>In 2019, we have to ramp up to take on a significantly larger workload. The current solution simply will not handle the amount of work we anticipate needing to handle. Enter <a href="https://metacpan.org/pod/Minion">Minion</a>.</p>

devdata/https_mojolicious.io_blog_2018_12_18_a-view-to-a-pod_  view on Meta::CPAN

                top: auto;
                left: -0.7em;
                color: #ddd;
            }
            h1:hover .permalink, h2:hover .permalink, h3:hover .permalink {
                color: #212529;
            }
            pre {
                border: 1px solid #ccc;
                border-radius: 5px;
                background: #f6f6f6;
                padding: 0.6em;
            }
            .crumbs .more {
                font-size: small;
            }
        &lt;/style&gt;
        &lt;title&gt;&lt;%= title %&gt;&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
        %= content



( run in 2.466 seconds using v1.01-cache-2.11-cpan-d8267643d1d )