Skip to content

Commit

Permalink
improved error handling in Mojolicious::Plugin::JSONConfig (closes #318)
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Apr 14, 2012
1 parent 50d6d56 commit 62ec604
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 21 deletions.
1 change: 1 addition & 0 deletions Changes
@@ -1,6 +1,7 @@
This file documents the revision history for Perl extension Mojolicious.

2.81 2012-04-14
- Improved error handling in Mojolicious::Plugin::JSONConfig.
- Improved router log messages.
- Improved all debug messages.
- Improved documentation.
Expand Down
6 changes: 0 additions & 6 deletions lib/Mojo/Headers.pm
Expand Up @@ -171,12 +171,6 @@ sub to_string {
return join "\x0d\x0a", @headers;
}

# DEPRECATED in Leaf Fluttering In Wind!
sub x_forwarded_for {
warn "Mojo::Headers->x_forwarded_for is DEPRECATED!\n";
shift->header('X-Forwarded-For' => @_);
}

1;
__END__
Expand Down
3 changes: 1 addition & 2 deletions lib/Mojo/Server.pm
Expand Up @@ -28,8 +28,7 @@ sub load_app {

# Clean up environment
local $ENV{MOJO_APP_LOADER} = 1;
local $ENV{MOJO_APP};
local $ENV{MOJO_EXE};
local ($ENV{MOJO_APP}, $ENV{MOJO_EXE});

# Try to load application from script into sandbox
my $class = 'Mojo::Server::SandBox::' . md5_sum($file . $$);
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/Server/CGI.pm
Expand Up @@ -3,7 +3,7 @@ use Mojo::Base 'Mojo::Server';

use constant CHUNK_SIZE => $ENV{MOJO_CHUNK_SIZE} || 131072;

has nph => 0;
has 'nph';

# "Lisa, you're a Buddhist, so you believe in reincarnation.
# Eventually, Snowball will be reborn as a higher lifeform...
Expand Down
9 changes: 0 additions & 9 deletions lib/Mojo/Server/Daemon.pm
Expand Up @@ -29,15 +29,6 @@ sub DESTROY {
$loop->remove($_) for @{$self->{listening} || []};
}

# DEPRECATED in Leaf Fluttering In Wind!
sub prepare_ioloop {
warn <<EOF;
Mojo::Server::Daemon->prepare_ioloop is DEPRECATED in favor of
Mojo::Server::Daemon->start!
EOF
shift->start(@_);
}

# "40 dollars!? This better be the best damn beer ever..
# *drinks beer* You got lucky."
sub run {
Expand Down
5 changes: 3 additions & 2 deletions lib/Mojolicious/Plugin/JSONConfig.pm
Expand Up @@ -45,8 +45,9 @@ sub render {
$prepend .= q/use Mojo::Base -strict;/;

# Render
my $mt = Mojo::Template->new($conf->{template} || {})->prepend($prepend);
return encode 'UTF-8', $mt->render($content, $app);
my $mt = Mojo::Template->new($conf->{template} || {});
my $json = $mt->prepend($prepend)->render($content, $app);
return ref $json ? die($json) : encode('UTF-8', $json);
}

1;
Expand Down
2 changes: 1 addition & 1 deletion t/pod_coverage.t
Expand Up @@ -10,7 +10,7 @@ plan skip_all => 'set TEST_POD to enable this test (developer only!)'
# DEPRECATED in Leaf Fluttering In Wind!
my @leaf = (
qw/controller_base_class default_static_class default_template_class drop/,
qw/dictionary max_redirects prepare_ioloop root unsubscribe x_forwarded_for/
qw/dictionary max_redirects root unsubscribe/
);

# "Marge, I'm going to miss you so much. And it's not just the sex.
Expand Down

0 comments on commit 62ec604

Please sign in to comment.