Acme-CPANModulesBundle-Import-MojoliciousAdvent-2018
view release on metacpan or search on metacpan
devdata/https_mojolicious.io_blog_2018_12_01_welcome-mojoconf-recap_ view on Meta::CPAN
<section id="section-1">
<p>Welcome to another year of the Mojolicious Advent Calendar!
2018 has been very good to Mojolicious and I could think of no better way to kick off this calendar than with a recap of the 2018 Nordic Perl Workshop and MojoConf held in Oslo, Norway.</p>
</section>
<section id="section-2">
<h2>Sidetrip to Western Norway</h2>
<p>On a personal note, I especially enjoyed this trip because I was able to take a few extra days to visit the West of Norway, home to the iconic fjords.
I visited Bergen and several of its Perlers before taking a fjord tour by boat and train.
It would have been the perfect trip if my bag hadn't decided that it wanted to stay an extra few days in Iceland where I'd had a delayed stop-over.</p>
<p>Still I had an amazing times and saw once in a lifetime sights!
Thanks to Christopher and Jonis and all the people whoe were my companions for the trip!</p>
<h2>Nordic Perl Workshop and MojoConf</h2>
<p>The Oslo Perl Mongers know how to throw Perl events!
This year I actually was there twice, having been once before for the <a href="http://blogs.perl.org/users/joel_berger/2018/04/perl-toolchain-summit-2018.html">Perl Toolchain Summit</a>.</p>
<p>Nordic Perl Workshop is, as its name implies, a regional workshop for Perl enthusiats to gather and talk Perl together.
devdata/https_mojolicious.io_blog_2018_12_15_practical-web-content-munging_ view on Meta::CPAN
toc: false
draft: false
---
This release includes a fog-flavored bauble of three equal sides, providing
the restless digital spirits a brief respite from their painful awareness of
impermanence.
You can find the new version under the usual shadowy bridge.
</code></pre>
<p>So, to start out, I need to fetch the old site. I could have bothered the old maintainer of the site about it and gotten the original sources, but I decided just to fetch them from the web. One option would be to use wget or curl; the stuff we do ...
<pre><code>use Mojo::UserAgent;
my $url = 'intro';
my $ua = Mojo::UserAgent->new;
my $tx = $ua->get("example.tld/$url.html");
</code></pre>
<p>That's it! We just fetched a web page. You might be tempted to print out $tx to see what's in it (that's what I did, rather than reading the docs, at first). But, it's a <a href="https://mojolicious.org/perldoc/Mojo/Transaction/HTT...
devdata/https_mojolicious.io_blog_2018_12_16_browser-diet_ view on Meta::CPAN
<p><img alt="JavaScript rhino image" class="pull-right" src="rhino.jpg"></p>
<p>If the JavaScript lives in the <code><head></code> tag, then the page body won't be parsed
until the script is downloaded. Some people get around this by putting the script just
before the end <code></body></code> tag, but the JS still has to download.
There are a couple of attributes that are hiding in the bushes.
<code>Async</code> and <code>defer</code> tell the browser to continue parsing the HTML while the
JavaScript is downloading. These two
<a href="https://flaviocopes.com/javascript-async-defer/">wise</a>
<a href="https://bitsofco.de/async-vs-defer/">owls</a>
can help decide which one to use.</p>
<p>Tell your script to load after the main page
with this
<a href="https://mojolicious.org/perldoc/Mojolicious/Plugin/TagHelpers#javascript">tag helper</a>
in your template</p>
<pre><code>%= javascript '/js/lib/jquery.min.js', defer => undef
</code></pre>
<p>which produces</p>
devdata/https_mojolicious.io_blog_2018_12_17_a-website-for-yancy_ view on Meta::CPAN
</div>
<div class="post-thumb">
<!-- theme suggests 1300x500 -->
<img alt="Code on a computer screen" src="/blog/2018/12/17/a-website-for-yancy/banner.jpg">
</div>
<div class="post-content">
<section id="section-1">
<p>For this year, I decided that Yancy needed a website. Rather than build
a website with a <a href="http://preaction.me/statocles">static site generator like
Statocles</a>, which is so popular these
days, I decided to do something wild and unpredictable: A dynamic
website! Lucky for me, I have the perfect project to easily build
a dynamic website: Yancy!</p>
</section>
<section id="section-2">
<p>The key part of any dynamic website is the database. Since I just want
to write Markdown and render HTML, my schema is quite simple: A place to
store the page's path, a place to store the page's Markdown for editing,
and a place to put the rendered HTML. I set up a SQLite database and
build the pages table using
( run in 2.068 seconds using v1.01-cache-2.11-cpan-4505f990765 )