Subject: | allow adapter class in same file |
The script below dies when Log::Any::Adapter tries to load the internal adapter class:
use strict;
use warnings;
package MyApp::Log::Adapter;
use base qw(Log::Any::Adapter::Base);
use Log::Any::Adapter::Util qw(make_method);
foreach my $method ( Log::Any->logging_methods() ) {
make_method($method, sub { print $_[1] });
}
foreach my $method ( Log::Any->detection_methods() ) {
make_method($method, sub { 1 });
}
package main;
use Log::Any::Adapter;
Log::Any::Adapter->set('+MyApp::Log::Adapter'); #dies here
It would be nice if it were possible to put adapters in the same file that they are used in (I need to do this for a standalone script).