Acme-CPANModulesBundle-Import-MojoliciousAdvent-2017
view release on metacpan or search on metacpan
"XML::Parser" : "0",
"XMLRPC::Fast" : "0",
"Yancy" : "0",
"Yancy::Backend::Dbic" : "0",
"Yancy::Backend::Mysql" : "0",
"Yancy::Backend::Pg" : "0",
"feature" : "0",
"ojo" : "0",
"ojoBox" : "0",
"strict" : "0",
"utf8" : "0",
"warnings" : "0"
}
}
},
"release_status" : "stable",
"resources" : {
"bugtracker" : {
"web" : "https://rt.cpan.org/Public/Dist/Display.html?Name=Acme-CPANModulesBundle-Import-MojoliciousAdvent-2017"
},
"homepage" : "https://metacpan.org/release/Acme-CPANModulesBundle-Import-MojoliciousAdvent-2017",
devdata/https_mojolicious.io_blog_2017_12_02_day-2-the-stash view on Meta::CPAN
<li><code>path</code></li>
<li><code>status</code></li>
<li><code>template</code></li>
<li><code>text</code></li>
<li><code>variant</code></li>
</ul>
<p>Additionally all keys like <code>mojo.*</code> are reserved for internal use.
Most of those values are either useful in routing, templating, or rendering.</p>
<p>You've seen <code>text</code>, which render a string by utf8 encoding it.
To render data in a binary format (or just text without being utf8 encoded) use the <code>data</code> key.
Both of those, as well as the <code>template</code> will be rendered with the content type <code>text/html</code>.
To use something different, you can specify it with the <code>format</code> key.</p>
<pre><code>use Mojolicious::Lite;
get '/' => {text => 'hello ð world!', format => 'txt'};
app->start;
</code></pre>
<p>Where the understood formats are listed <a href="http://mojolicious.org/perldoc/Mojolicious/Types#DESCRIPTION">here</a> (and more <a href="http://mojolicious.org/perldoc/Mojolicious/Types#DESCRIPTION">can be added</a>).</p>
devdata/https_mojolicious.io_blog_2017_12_12_day-12-more-than-a-base-class view on Meta::CPAN
Let's see how it does it.</p>
</section>
<section id="section-2">
<h2>Importing Pragma and Functionality</h2>
<p>Most of the authors in the modern Perl commmunity recommend that all Perl code use the <a href="https://metacpan.org/pod/strict">strict</a> and <a href="https://metacpan.org/pod/warnings">warnings</a> pragmas.
Like many of the major Perl object frameworks, <a href="https://metacpan.org/pod/Moose">Moose</a> and <a href="https://metacpan.org/pod/Moo">Moo</a> included, Mojo::Base feels these are important enough that it imports them for you.
Unlike those others, it goes further.</p>
<p>Since the modern web is trending towards UTF-8 encoding, the <a href="https://metacpan.org/pod/utf8">utf8</a> pragma is loaded; this enables you to use UTF-8 encoded characters right in your script.
Mojolicious does much of your web-facing encoding for you so this <strong>almost</strong> means you don't have to think about character encoding at all!</p>
<p>And because Mojolicious itself requires Perl 5.10, it also enables all of the <a href="https://metacpan.org/pod/feature">features</a> that came with that version.
This includes <a href="https://www.effectiveperlprogramming.com/2009/12/perl-5-10-new-features/">handy functionality</a> like the <code>state</code> and <code>say</code> keywords as well as the defined-or operator <code>//</code>.
Finally it imports IO::Handle so that all of your handles behave as objects (if you don't know what that means or why, don't worry about it).</p>
<p>If this is the only thing you want from Mojo::Base, perhaps in a script or a test file, all you do is pass the <code>-strict</code> flag</p>
<pre><code>use Mojo::Base -strict;
</code></pre>
lib/Acme/CPANModules/Import/MojoliciousAdvent/2017.pm view on Meta::CPAN
package Acme::CPANModules::Import::MojoliciousAdvent::2017;
our $DATE = '2018-12-30'; # DATE
our $VERSION = '0.001'; # VERSION
our $LIST = {description=>"This list is generated by extracting module names mentioned in [https://mojolicious.io/page/advent/2017/] (retrieved on 2018-12-30). Visit the URL for the full contents.",entries=>[{module=>"App::cpanminus"},{module=>"Mojo:...
1;
# ABSTRACT: Modules mentioned in Mojolicious Advent Calendar 2017
__END__
=pod
=encoding UTF-8
lib/Acme/CPANModules/Import/MojoliciousAdvent/2017.pm view on Meta::CPAN
=item * L<MooX::ChainedAttributes>
=item * L<MooX::StrictConstructor>
=item * L<Moose>
=item * L<feature>
=item * L<strict>
=item * L<utf8>
=item * L<warnings>
=item * L<Class::Method::Modifiers>
=item * L<List::UtilsBy>
=item * L<Mojo::Collection>
=item * L<Mojo::Collection::Role::UtilsBy>
lib/Acme/CPANModules/Import/MojoliciousAdvent/2017_12_12.pm view on Meta::CPAN
package Acme::CPANModules::Import::MojoliciousAdvent::2017_12_12;
our $DATE = '2018-12-30'; # DATE
our $VERSION = '0.001'; # VERSION
our $LIST = {description=>"This list is generated by extracting module names mentioned in [https://mojolicious.io/blog/2017/12/12/day-12-more-than-a-base-class] (retrieved on 2018-12-30). Visit the URL for the full contents.",entries=>[{module=>"Mojo...
1;
# ABSTRACT: Modules mentioned in Mojolicious Advent Calendar 2017 (day 12)
__END__
=pod
=encoding UTF-8
lib/Acme/CPANModules/Import/MojoliciousAdvent/2017_12_12.pm view on Meta::CPAN
=item * L<MooX::ChainedAttributes>
=item * L<MooX::StrictConstructor>
=item * L<Moose>
=item * L<feature>
=item * L<strict>
=item * L<utf8>
=item * L<warnings>
=back
=head1 HOMEPAGE
Please visit the project's homepage at L<https://metacpan.org/release/Acme-CPANModulesBundle-Import-MojoliciousAdvent-2017>.
=head1 SOURCE
( run in 1.076 second using v1.01-cache-2.11-cpan-49f99fa48dc )