PAR-Packer
view release on metacpan or search on metacpan
workarounds. __FILE__ is typically used to refer to installed non-module
resources, e.g.
# MIME::Types
my $db = File::Spec->catfile(dirname(__FILE__), 'types.db');
# Mozilla::CA
my $ca_file = File::Spec->catfile(dirname(__FILE__), "CA", "cacert.pem");
# Mojo::File (__FILE__ used implicitly by caller())
sub curfile { __PACKAGE__->new(Cwd::realpath((caller)[1])) }
Hence, remove known workarounds from Filter::PatchContent and add a test.
- Fix RT#130685: core module detection doesn't work with -Duserelocatableinc
Original patch by Frank.Lichtenheld@Sophos.com, thanx!
Added a test for this.
1.049 2019-05-31
t/85-myfile.t view on Meta::CPAN
my ($out, $err) = run_ok($exe);
our $data;
eval($out);
my $exp_file = catfile($data->{par_temp}, qw( inc lib Myfile.pm ));
$exp_file =~ s{\\}{/}g if $^O eq 'MSWin32';
is($data->{from_file}, $exp_file, "expected source path from __FILE__");
ok(-e $data->{from_file}, "file __FILE__ exists");
is($data->{from_caller}, $exp_file, "expected source path from (caller)[1]");
ok(-e $data->{from_caller}, "file (caller)[1] exists");
t/data/lib/Myfile.pm view on Meta::CPAN
package Myfile;
use strict;
use warnings;
use Cwd;
sub from_caller { Cwd::realpath(_from_caller()) }
sub _from_caller { (caller)[1] }
sub from_file { Cwd::realpath(__FILE__) }
1;
( run in 1.463 second using v1.01-cache-2.11-cpan-a3c8064c92c )