in reply to a few questions about __PACKAGE__

What you have there does not compile

syntax error at Module.pm line 5, near "$\(" BEGIN not safe after errors--compilation aborted at Module.pm line 5.

I presume your code is closer to

package Module; use strict; use warnings; BEGIN { my $pathname = $INC{"$\(__PACKAGE__)}.pm"}; $pathname =~ s/\.pm$/.conf/; } 1;

If so, the problem is that

"$\(__PACKAGE__)}.pm"

is the same as

$\ . "(__PACKAGE__)}.pm"

because $\ is a variable. You want

my $pathname = $INC{__PACKAGE__ . ".pm"};

Except that will fail if your module name has more than one part (e.g. "Foo::Bar"), and it's more complicated that it needs to be. You really just want

my $pathname = __FILE__;