Subject: | Devel::MAT::Dumper should not be affected by chdir() used in a script |
00:59 < xenu> LeoNerd: i have a suggestion to add something like this to Devel::MAT: <attached patch>
01:00 < xenu> i'm aware of -eager_open
01:00 < xenu> but i don't see why anyone would ever want Devel::MAT to store dump at cwd changed by a script
01:01 < xenu> or maybe eager_open should be default? dunno
01:02 < xenu> probably you don't care, but this behaviour is *extremely* unintuitive
Subject: | mat1.patch |
=== modified file 'lib/Devel/MAT/Dumper.pm'
--- lib/Devel/MAT/Dumper.pm 2016-06-03 18:16:14 +0000
+++ lib/Devel/MAT/Dumper.pm 2016-09-14 22:54:15 +0000
@@ -10,6 +10,7 @@
our $VERSION = '0.24';
+use Cwd qw( abs_path );
use File::Basename qw( basename );
require XSLoader;
@@ -103,7 +104,7 @@
our $MAX_STRING = 256; # used by XS code
-my $dumpfile_name = basename( $0 ) . ".pmat";
+my $dumpfile_name = abs_path( basename( $0 ) . ".pmat" );
my $dumpfh;
my $next_serial = 0;
@@ -165,7 +166,7 @@
};
}
elsif( $sym eq "-file" ) {
- $dumpfile_name = shift;
+ $dumpfile_name = abs_path( shift );
}
elsif( $sym eq "-max_string" ) {
$MAX_STRING = shift;