The original question has been reformulated, to be clear for later use
I find the following issue to be weird. In some cases %M and %F refers to different files. For example int the following case:
Foo.pm contains
use warnings;
sub x { 2; 1; }
1;
test.pl contains
#!/usr/bin/perl
use Log::Log4perl qw/:easy/;
Log::Log4perl->easy_init({ file => 'STDOUT', layout => '[%p{1}] %m{chomp} [%l]%n' });
$::log = Log::Log4perl->get_logger;
local $SIG{__WARN__} = sub {
local $Log::Log4perl::caller_depth = $Log::Log4perl::caller_depth + 1;
$::log->warn(shift);
};
require "Foo.pm";
Result is:
[W] Useless use of a constant in void context at Foo.pm line 2. [main:: Foo.pm (2)]
So file is "Foo.pm", but the function is "main::".
I found that the weird behavior is in connection with errors/warnings happening in compile time of "require".
Why do %M and %F differ?
Thanks, FERcsI