Acme-CPANModulesBundle-Import-MojoliciousAdvent-2018

 view release on metacpan or  search on metacpan

LICENSE  view on Meta::CPAN

MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.

  10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.

                     END OF TERMS AND CONDITIONS

        Appendix: How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to humanity, the best way to achieve this is to make it

devdata/https_mojolicious.io_blog_2018_12_02_automatic-reload-for-rapid-development_  view on Meta::CPAN

<p>To use the plugin, we add it to our application using the <code>plugin</code> method.
Then, we add the <code>auto_reload</code> helper to our <a href="https://metacpan.org/pod/distribution/Mojolicious/lib/Mojolicious/Guides/Tutorial.pod#Layouts">layout
template</a></p>

<pre><code>use Mojolicious::Lite;

plugin &#39;AutoReload&#39;;
get &#39;/&#39; =&gt; &#39;index&#39;;

app-&gt;start;
__DATA__

@@ layouts/default.html.ep
%= auto_reload
%= content

@@ index.html.ep
% layout &#39;default&#39;;
&lt;h1&gt;Hello, World!&lt;/h1&gt;
</code></pre>

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


              </section>
              <section id="section-2">
                  <h1>Step 1: Build The List</h1>

<p>First, we need a database schema. Santa only really needs to know if someone
has been naughty or nice, so our schema is pretty simple. We&#39;ll start our
<a href="https://mojolicious.org/perldoc/Mojolicious/Guides/Tutorial">Mojolicious::Lite</a>
app by connecting to a <a href="http://sqlite.org">SQLite</a> database using
<a href="https://metacpan.org/pod/Mojo::SQLite">Mojo::SQLite</a> and loading our database
schema from the <a href="https://perldoc.perl.org/perldata.html#Special-Literals"><strong>DATA</strong> section of our
script</a> using
<a href="https://metacpan.org/pod/Mojo::SQLite::Migrations">Mojo::SQLite migrations</a>:</p>

<pre><code>use v5.28;
use Mojolicious::Lite;
use Mojo::SQLite;

# Connect to the SQLite database and load our schema from the
# &#39;@@ migrations&#39; section, below
my $db = Mojo::SQLite-&gt;new( &#39;sqlite:thelist.db&#39; );
$db-&gt;auto_migrate(1)-&gt;migrations-&gt;from_data();

# Start the app. Must be the last code of the script.
app-&gt;start;

__DATA__
@@ migrations
-- 1 up
CREATE TABLE the_list (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    name VARCHAR NOT NULL,
    address VARCHAR NOT NULL,
    is_nice BOOLEAN DEFAULT FALSE,
    is_delivered BOOLEAN DEFAULT FALSE
);
</code></pre>

devdata/https_mojolicious.io_blog_2018_12_17_a-website-for-yancy_  view on Meta::CPAN

use Mojo::SQLite;
helper db =&gt; sub {
    state $db = Mojo::SQLite-&gt;new( &#39;sqlite:&#39; . app-&gt;home-&gt;child( &#39;docs.db&#39; ) );
    return $db;
};
app-&gt;db-&gt;auto_migrate(1)-&gt;migrations-&gt;from_data();

# Start the app. Must be the code of the script
app-&gt;start;

__DATA__
@@ migrations
-- 1 up
CREATE TABLE pages (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    path VARCHAR UNIQUE NOT NULL,
    markdown TEXT,
    html TEXT
);
</code></pre>

devdata/https_mojolicious.io_blog_2018_12_17_a-website-for-yancy_  view on Meta::CPAN


<pre><code>get &#39;/*id&#39; =&gt; {
    id =&gt; &#39;index&#39;, # Default to index page
    controller =&gt; &#39;yancy&#39;,
    action =&gt; &#39;get&#39;,
    collection =&gt; &#39;pages&#39;,
    template =&gt; &#39;pages&#39;,
};
# Start the app. Must be the last code of the script
app-&gt;start;
__DATA__
@@ pages.html.ep
% layout &#39;default&#39;;
%== $item-&gt;{html}

@@ layouts/default.html.ep
&lt;!DOCTYPE html&gt;
&lt;html&gt;
    &lt;head&gt;
        &lt;link rel=&quot;stylesheet&quot; href=&quot;/yancy/bootstrap.css&quot;&gt;
        &lt;title&gt;&lt;%= title %&gt;&lt;/title&gt;

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

needs to use the default site layout, and a little additional CSS will
also make the documentation look a lot better!</p>

<pre><code>use Mojolicious::Lite;
plugin &#39;PODViewer&#39;, {
    default_module =&gt; &#39;Yancy&#39;,
    allow_modules =&gt; [qw( Yancy Mojolicious::Plugin::Yancy )],
    layout =&gt; &#39;default&#39;,
};
app-&gt;start;
__DATA__
@@ layouts/default.html.ep
&lt;!DOCTYPE html&gt;
&lt;html&gt;
    &lt;head&gt;
        &lt;link rel=&quot;stylesheet&quot; href=&quot;/yancy/bootstrap.css&quot;&gt;
        &lt;style&gt;
            h1 { font-size: 2.00rem }
            h2 { font-size: 1.75rem }
            h3 { font-size: 1.50rem }
            h1, h2, h3 {



( run in 0.510 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )