Skip to content

Commit

Permalink
use utf8 in Mojo::Base
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Dec 19, 2012
1 parent 112a6d2 commit 34d8bfa
Show file tree
Hide file tree
Showing 34 changed files with 16 additions and 85 deletions.
7 changes: 6 additions & 1 deletion lib/Mojo/Base.pm
Expand Up @@ -4,6 +4,7 @@ use strict;
use warnings;

# Mojo modules are modern!
use utf8;
use feature ();

# No imports because we get subclassed, a lot!
Expand Down Expand Up @@ -44,6 +45,7 @@ sub import {
# Mojo modules are strict!
strict->import;
warnings->import;
utf8->import;
feature->import(':5.10');
}

Expand Down Expand Up @@ -138,7 +140,7 @@ Mojo::Base - Minimal base class for Mojo projects
L<Mojo::Base> is a simple base class for L<Mojo> projects.
# Automatically enables "strict", "warnings" and Perl 5.10 features
# Automatically enables "strict", "warnings", "utf8" and Perl 5.10 features
use Mojo::Base -strict;
use Mojo::Base -base;
use Mojo::Base 'SomeBaseClass';
Expand All @@ -148,12 +150,14 @@ All three forms save a lot of typing.
# use Mojo::Base -strict;
use strict;
use warnings;
use utf8;
use feature ':5.10';
use IO::Handle ();
# use Mojo::Base -base;
use strict;
use warnings;
use utf8;
use feature ':5.10';
use IO::Handle ();
use Mojo::Base;
Expand All @@ -163,6 +167,7 @@ All three forms save a lot of typing.
# use Mojo::Base 'SomeBaseClass';
use strict;
use warnings;
use utf8;
use feature ':5.10';
use IO::Handle ();
require SomeBaseClass;
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/Template.pm
Expand Up @@ -380,7 +380,7 @@ content with the L<Mojolicious> renderer.
=head1 SYNTAX
For all templates L<strict>, L<warnings> and Perl 5.10 features are
For all templates L<strict>, L<warnings>, L<utf8> and Perl 5.10 features are
automatically enabled.
<% Perl code %>
Expand Down
14 changes: 0 additions & 14 deletions lib/Mojolicious/Guides/Rendering.pod
Expand Up @@ -835,20 +835,6 @@ be easily changed.

1;

All templates from the C<DATA> section are bound to the encoding of the Perl
script, so don't forget to use the L<utf8> pragma if necessary.

use Mojolicious::Lite;
use utf8;

get '/heart';

app->start;
__DATA__

@@ heart.html.ep
I ♥ Mojolicious!

=head2 Base64 encoded DATA files

Base64 encoded static files such as images can be easily stored in the C<DATA>
Expand Down
5 changes: 0 additions & 5 deletions lib/Mojolicious/Guides/Routing.pod
Expand Up @@ -685,14 +685,9 @@ Less commonly used and more powerful features.
IRIs are handled transparently, that means paths are guaranteed to be
unescaped and decoded to Perl characters.

use utf8;

# GET /☃ (unicode snowman) -> {controller => 'foo', action => 'snowman'}
$r->get('/☃')->to('foo#snowman');

Just don't forget to use the L<utf8> pragma or you'll make the Unicode snowman
very sad.

=head2 Rearranging routes

Until the first request has been handled, all routes can still be moved around
Expand Down
10 changes: 5 additions & 5 deletions lib/Mojolicious/Lite.pm
Expand Up @@ -62,7 +62,7 @@ Mojolicious::Lite - Real-time micro web framework
=head1 SYNOPSIS
# Automatically enables "strict", "warnings" and Perl 5.10 features
# Automatically enables "strict", "warnings", "utf8" and Perl 5.10 features
use Mojolicious::Lite;
# Route with placeholder
Expand All @@ -88,10 +88,10 @@ applications.
=head2 Hello World
A simple Hello World application can look like this, L<strict>, L<warnings>
and Perl 5.10 features are automatically enabled and a few functions imported
when you use L<Mojolicious::Lite>, turning your script into a full featured
web application.
A simple Hello World application can look like this, L<strict>, L<warnings>,
L<utf8> and Perl 5.10 features are automatically enabled and a few functions
imported when you use L<Mojolicious::Lite>, turning your script into a full
featured web application.
#!/usr/bin/env perl
use Mojolicious::Lite;
Expand Down
8 changes: 4 additions & 4 deletions lib/Mojolicious/Plugin/Config.pm
Expand Up @@ -108,10 +108,10 @@ Mojolicious::Plugin::Config - Perl-ish configuration plugin
L<Mojolicious::Plugin::Config> is a Perl-ish configuration plugin.
The application object can be accessed via C<$app> or the C<app> function,
L<strict>, L<warnings> and Perl 5.10 features are automatically enabled. You
can extend the normal configuration file C<myapp.conf> with C<mode> specific
ones like C<myapp.$mode.conf>. A default configuration filename will be
generated by decamelizing the application class with
L<strict>, L<warnings>, L<utf8> and Perl 5.10 features are automatically
enabled. You can extend the normal configuration file C<myapp.conf> with
C<mode> specific ones like C<myapp.$mode.conf>. A default configuration
filename will be generated by decamelizing the application class with
L<Mojo::Util/"decamelize"> or from the application filename.
The code of this plugin is a good example for learning to build new plugins,
Expand Down
2 changes: 0 additions & 2 deletions t/mojo/bytestream.t
@@ -1,7 +1,5 @@
use Mojo::Base -strict;

use utf8;

use Test::More;
use File::Spec::Functions qw(catfile splitdir);
use File::Temp 'tempdir';
Expand Down
2 changes: 0 additions & 2 deletions t/mojo/dom.t
@@ -1,7 +1,5 @@
use Mojo::Base -strict;

use utf8;

use Test::More;
use Mojo::DOM;
use Mojo::Util 'encode';
Expand Down
2 changes: 0 additions & 2 deletions t/mojo/json.t
Expand Up @@ -8,8 +8,6 @@ sub TO_JSON { shift->something }
package main;
use Mojo::Base -strict;

use utf8;

use Test::More;
use Mojo::ByteStream 'b';
use Mojo::JSON;
Expand Down
2 changes: 0 additions & 2 deletions t/mojo/json_pointer.t
@@ -1,7 +1,5 @@
use Mojo::Base -strict;

use utf8;

use Test::More;
use Mojo::JSON::Pointer;

Expand Down
2 changes: 0 additions & 2 deletions t/mojo/parameters.t
@@ -1,7 +1,5 @@
use Mojo::Base -strict;

use utf8;

use Test::More;
use Mojo::Parameters;

Expand Down
2 changes: 0 additions & 2 deletions t/mojo/path.t
@@ -1,7 +1,5 @@
use Mojo::Base -strict;

use utf8;

use Test::More;
use Mojo::Path;

Expand Down
2 changes: 0 additions & 2 deletions t/mojo/request.t
@@ -1,7 +1,5 @@
use Mojo::Base -strict;

use utf8;

use Test::More;
use File::Spec::Functions 'catfile';
use File::Temp 'tempdir';
Expand Down
2 changes: 0 additions & 2 deletions t/mojo/template.t
Expand Up @@ -15,8 +15,6 @@ sub exception { die 'ohoh' }
package main;
use Mojo::Base -strict;

use utf8;

use Test::More;
use File::Spec::Functions qw(catfile splitdir);
use FindBin;
Expand Down
2 changes: 0 additions & 2 deletions t/mojo/transactor.t
@@ -1,7 +1,5 @@
use Mojo::Base -strict;

use utf8;

use Test::More;
use File::Spec::Functions 'catdir';
use FindBin;
Expand Down
2 changes: 0 additions & 2 deletions t/mojo/url.t
@@ -1,7 +1,5 @@
use Mojo::Base -strict;

use utf8;

use Test::More;
use Mojo::URL;

Expand Down
2 changes: 0 additions & 2 deletions t/mojo/util.t
@@ -1,7 +1,5 @@
use Mojo::Base -strict;

use utf8;

use Test::More;
use File::Spec::Functions qw(catfile splitdir);
use File::Temp 'tempdir';
Expand Down
2 changes: 0 additions & 2 deletions t/mojolicious/charset_lite_app.t
@@ -1,7 +1,5 @@
use Mojo::Base -strict;

use utf8;

# Disable IPv6 and libev
BEGIN {
$ENV{MOJO_NO_IPV6} = 1;
Expand Down
2 changes: 0 additions & 2 deletions t/mojolicious/dispatch.t
Expand Up @@ -21,8 +21,6 @@ sub reset_state {
package main;
use Mojo::Base -strict;

use utf8;

use Test::More;
use Mojo::Transaction::HTTP;
use Mojo::Upload;
Expand Down
2 changes: 0 additions & 2 deletions t/mojolicious/embedded_app.t
@@ -1,7 +1,5 @@
use Mojo::Base -strict;

use utf8;

# Disable IPv6 and libev
BEGIN {
$ENV{MOJO_MODE} = 'testing';
Expand Down
2 changes: 0 additions & 2 deletions t/mojolicious/embedded_lite_app.t
@@ -1,7 +1,5 @@
use Mojo::Base -strict;

use utf8;

# Disable IPv6 and libev
BEGIN {
$ENV{MOJO_MODE} = 'testing';
Expand Down
2 changes: 0 additions & 2 deletions t/mojolicious/exception_lite_app.t
@@ -1,7 +1,5 @@
use Mojo::Base -strict;

use utf8;

# Disable IPv6 and libev
BEGIN {
$ENV{MOJO_MODE} = 'development';
Expand Down
1 change: 0 additions & 1 deletion t/mojolicious/external/myapp.conf
@@ -1,3 +1,2 @@
use utf8;
app->defaults(also => 'works!!!', in => __PACKAGE__);
{just => "works ♥!"};
2 changes: 0 additions & 2 deletions t/mojolicious/external/myapp.pl
@@ -1,7 +1,5 @@
#!/usr/bin/env perl

use utf8;

use Mojolicious::Lite;

# Default for config file tests
Expand Down
2 changes: 0 additions & 2 deletions t/mojolicious/external_app.t
@@ -1,7 +1,5 @@
use Mojo::Base -strict;

use utf8;

# Disable IPv6 and libev
BEGIN {
$ENV{MOJO_MODE} = 'testing';
Expand Down
2 changes: 0 additions & 2 deletions t/mojolicious/external_lite_app.t
@@ -1,7 +1,5 @@
use Mojo::Base -strict;

use utf8;

# Disable IPv6 and libev
BEGIN {
$ENV{MOJO_MODE} = 'testing';
Expand Down
2 changes: 0 additions & 2 deletions t/mojolicious/group_lite_app.t
@@ -1,7 +1,5 @@
use Mojo::Base -strict;

use utf8;

# Disable IPv6 and libev
BEGIN {
$ENV{MOJO_NO_IPV6} = 1;
Expand Down
2 changes: 0 additions & 2 deletions t/mojolicious/json_config_lite_app.t
@@ -1,7 +1,5 @@
use Mojo::Base -strict;

use utf8;

# Disable IPv6 and libev
BEGIN {
$ENV{MOJO_NO_IPV6} = 1;
Expand Down
2 changes: 0 additions & 2 deletions t/mojolicious/json_config_mode_lite_app.t
@@ -1,7 +1,5 @@
use Mojo::Base -strict;

use utf8;

# Disable IPv6 and libev
BEGIN {
$ENV{MOJO_MODE} = 'testing';
Expand Down
2 changes: 0 additions & 2 deletions t/mojolicious/lite_app.t
@@ -1,7 +1,5 @@
use Mojo::Base -strict;

use utf8;

# Disable IPv6 and libev
BEGIN {
$ENV{MOJO_MODE} = 'development';
Expand Down
2 changes: 0 additions & 2 deletions t/mojolicious/ojo.t
@@ -1,7 +1,5 @@
use Mojo::Base -strict;

use utf8;

# Disable IPv6, libev and proxy detection
BEGIN {
$ENV{MOJO_MODE} = 'development';
Expand Down
2 changes: 0 additions & 2 deletions t/mojolicious/tag_helper_lite_app.t
@@ -1,7 +1,5 @@
use Mojo::Base -strict;

use utf8;

# Disable IPv6 and libev
BEGIN {
$ENV{MOJO_NO_IPV6} = 1;
Expand Down
2 changes: 0 additions & 2 deletions t/mojolicious/twinkle_lite_app.t
@@ -1,7 +1,5 @@
use Mojo::Base -strict;

use utf8;

# Disable IPv6 and libev
BEGIN {
$ENV{MOJO_NO_IPV6} = 1;
Expand Down
2 changes: 0 additions & 2 deletions t/mojolicious/websocket_lite_app.t
@@ -1,7 +1,5 @@
use Mojo::Base -strict;

use utf8;

# Disable IPv6 and libev
BEGIN {
$ENV{MOJO_NO_IPV6} = 1;
Expand Down

0 comments on commit 34d8bfa

Please sign in to comment.