Skip Menu |

This queue is for tickets about the Devel-MAT CPAN distribution.

Report information
The Basics
Id: 119164
Status: resolved
Priority: 0/
Queue: Devel-MAT

People
Owner: Nobody in particular
Requestors: leonerd-cpan [...] leonerd.org.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.24
Fixed in: 0.25



Subject: D:M:Dumper on "-e" makes awkwardly named files
If you dump a "-e" or "-E" commandline, you end up with a file called `-e.pmat`. Trying to load that in other commandline tools is awkward. Some of them use Getopt::Long and some do not, so it's hard to guess which of pmat-foo -- -e.pmat pmat-foo -e.pmat to use. -- Paul Evans
Fixed; will be in next release -- Paul Evans
Subject: rt119164.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 2017-03-22 16:22:12 +0000 @@ -1,7 +1,7 @@ # You may distribute under the terms of either the GNU General Public License # or the Artistic License (the same terms as Perl itself) # -# (C) Paul Evans, 2013-2016 -- leonerd@leonerd.org.uk +# (C) Paul Evans, 2013-2017 -- leonerd@leonerd.org.uk package Devel::MAT::Dumper; @@ -82,6 +82,14 @@ $ perl -MDevel::MAT::Dumper=-file,foo.pmat ... +In the special case that C<$0> is exactly the string C<-e> or C<-E>, the +filename will be prefixed with C<perl> so as not to create files whose names +begin with a leading hyphen, as this confuses some commandline parsers. + + $ perl -MDevel::MAT::Dumper=-dump_at_END -E 'say "hello"' + hello + Dumping to perl-e.pmat because of END + If the pattern contains C<NNN>, this will be replaced by a unique serial number per written file, starting from 0. This may be helpful in the case of C<DIE> or C<SIGQUIT> handlers, which could be invoked multiple times. @@ -103,7 +111,10 @@ our $MAX_STRING = 256; # used by XS code -my $dumpfile_name = basename( $0 ) . ".pmat"; +my $basename = basename( $0 ); +$basename = "perl$basename" if $basename =~ m/^-e$/i; # RT119164 +my $dumpfile_name = "$basename.pmat"; + my $dumpfh; my $next_serial = 0;
Was released in 0.25 -- Paul Evans