Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix this module on Mojo 6, for the CPAN PR challenge #7

Merged
merged 1 commit into from Jun 8, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/Mojolicious/Plugin/ConsoleLogger.pm
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ sub register {
# override Mojo::Log->log
no strict 'refs';
my $stash = \%{"Mojo::Log::"};
my $orig = delete $stash->{"log"};

# Mojolicious 6 renames Mojo::Log::log to Mojo::Log::_log
my $logsub = (defined &Mojo::Log::_log) ? "_log" : "log";
my $orig = delete $stash->{$logsub};

*{"Mojo::Log::log"} = sub {
*{"Mojo::Log::$logsub"} = sub {
push @{$plugin->logs->{$_[1]}} => $_[-1];

# Original Mojo::Log->log
Expand Down
4 changes: 2 additions & 2 deletions t/logger.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ use Test::Mojo;

# Make sure sockets are working
plan skip_all => 'working sockets required for this test!'
unless Mojo::IOLoop->new->generate_port; # Test server
unless Mojo::IOLoop::Server->new->generate_port; # Test server

use Mojolicious::Lite;

plugin 'console_logger';
plugin 'ConsoleLogger';

get '/:template' => sub {
my $self = shift;
Expand Down