/usr/share/perl5/Mojolicious/Plugin/Charset.pm is in libmojolicious-perl 5.54+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | package Mojolicious::Plugin::Charset;
use Mojo::Base 'Mojolicious::Plugin';
sub register {
my ($self, $app, $conf) = @_;
return unless my $c = $conf->{charset};
$app->types->type(html => "text/html;charset=$c");
$app->renderer->encoding($c);
$app->hook(before_dispatch =>
sub { shift->req->default_charset($c)->url->query->charset($c) });
}
1;
=encoding utf8
=head1 NAME
Mojolicious::Plugin::Charset - Charset plugin
=head1 SYNOPSIS
# Mojolicious
$self->plugin(Charset => {charset => 'Shift_JIS'});
# Mojolicious::Lite
plugin Charset => {charset => 'Shift_JIS'};
=head1 DESCRIPTION
L<Mojolicious::Plugin::Charset> is a plugin to easily set the default charset
and encoding on all layers of L<Mojolicious>.
The code of this plugin is a good example for learning to build new plugins,
you're welcome to fork it.
See L<Mojolicious::Plugins/"PLUGINS"> for a list of plugins that are available
by default.
=head1 OPTIONS
L<Mojolicious::Plugin::Charset> supports the following options.
=head2 charset
# Mojolicious::Lite
plugin Charset => {charset => 'Shift_JIS'};
Application charset.
=head1 METHODS
L<Mojolicious::Plugin::Charset> inherits all methods from
L<Mojolicious::Plugin> and implements the following new ones.
=head2 register
$plugin->register(Mojolicious->new, {charset => 'Shift_JIS'});
Register hook L<Mojolicious/"before_dispatch"> in application and change a few
defaults.
=head1 SEE ALSO
L<Mojolicious>, L<Mojolicious::Guides>, L<http://mojolicio.us>.
=cut
|