diff options
author | Vincent Pit <perl@profvince.com> | 2012-06-25 15:49:06 +0200 |
---|---|---|
committer | Vincent Pit <perl@profvince.com> | 2012-06-25 15:49:06 +0200 |
commit | f311474dd37709a4f0d401dfbfce021e4e3cadbb (patch) | |
tree | 148382584133cfdcdad31a7b97aa946d85170274 /lib | |
parent | ea7bdd87ed0a0e43dbc038182ac2ebde79570a5e (diff) | |
download | perl-f311474dd37709a4f0d401dfbfce021e4e3cadbb.tar.gz |
Fix (and test) module listing in the debugger
This was also broken when 'use strict' was added.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/perl5db.pl | 5 | ||||
-rw-r--r-- | lib/perl5db.t | 21 | ||||
-rw-r--r-- | lib/perl5db/t/load-modules | 6 |
3 files changed, 29 insertions, 3 deletions
diff --git a/lib/perl5db.pl b/lib/perl5db.pl index b692f6f216..6e08d59883 100644 --- a/lib/perl5db.pl +++ b/lib/perl5db.pl @@ -7202,8 +7202,9 @@ sub list_modules { # versions # If the package has a $VERSION package global (as all good packages # should!) decode it and save as partial message. - if ( defined ${ $_ . '::VERSION' } ) { - $version{$file} = "${ $_ . '::VERSION' } from "; + my $pkg_version = do { no strict 'refs'; ${ $_ . '::VERSION' } }; + if ( defined $pkg_version ) { + $version{$file} = "$pkg_version from "; } # Finish up the message with the file the package came from. diff --git a/lib/perl5db.t b/lib/perl5db.t index 634288cac6..7cca75c59f 100644 --- a/lib/perl5db.t +++ b/lib/perl5db.t @@ -28,7 +28,7 @@ BEGIN { } } -plan(31); +plan(32); my $rc_filename = '.perldb'; @@ -831,6 +831,25 @@ package main; ); } +# Test for 'M' (module list). +{ + my $wrapper = DebugWrap->new( + { + cmds => + [ + 'M', + 'q', + ], + prog => '../lib/perl5db/t/load-modules' + } + ); + + $wrapper->contents_like( + qr[Scalar/Util\.pm], + 'M (module list) works fine', + ); +} + END { 1 while unlink ($rc_filename, $out_fn); } diff --git a/lib/perl5db/t/load-modules b/lib/perl5db/t/load-modules new file mode 100644 index 0000000000..202326357c --- /dev/null +++ b/lib/perl5db/t/load-modules @@ -0,0 +1,6 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Scalar::Util; |