Front page | perl.perl5.changes |
Postings from May 2009
[perl.git] branch blead, updated. GitLive-blead-1237-g20f91e4
From:
Steffen Mueller
Date:
May 31, 2009 13:37
Subject:
[perl.git] branch blead, updated. GitLive-blead-1237-g20f91e4
Message ID:
E1MArlz-0002X6-7p@camel.booking.com
In perl.git, the branch blead has been updated
<http://perl5.git.perl.org/perl.git/commitdiff/20f91e418dfa8bdf6cf78614bfebebc28a7613ee?hp=c494f1f4488c4f068dec8514f981347f6dae60a6>
- Log -----------------------------------------------------------------
commit 20f91e418dfa8bdf6cf78614bfebebc28a7613ee
Author: Steffen Mueller <smueller@cpan.org>
Date: Sun May 31 22:02:33 2009 +0200
Mention Devel::NYTProf in perldebug
In the short section about profiling with Devel::DProf, we now mention
that other profilers (such as Devel::NYTProf) are available from CPAN.
M pod/perldebug.pod
commit d22862789d0938361a070647ab6fe995d674f77c
Author: Steffen Mueller <smueller@cpan.org>
Date: Sun May 31 21:57:24 2009 +0200
Auto-complete lexicals in the debugger shell
When typing the name of a lexical variable in the debugger shell, its
name can now be tab auto-completed just like package variables. Requires
PadWalker to be available. Silently skips lexicals if it's not.
M lib/perl5db.pl
M pod/perldebug.pod
-----------------------------------------------------------------------
Summary of changes:
lib/perl5db.pl | 29 +++++++++++++++++++++++++++--
pod/perldebug.pod | 11 ++++++-----
2 files changed, 33 insertions(+), 7 deletions(-)
diff --git a/lib/perl5db.pl b/lib/perl5db.pl
index 9162d16..b851212 100644
--- a/lib/perl5db.pl
+++ b/lib/perl5db.pl
@@ -8610,7 +8610,6 @@ If there's only one hit, and it's a package qualifier, and it's not equal to the
=cut
if ( $text =~ /^[\$@%]/ ) { # symbols (in $package + packages in main)
-
=pod
=over 4
@@ -8634,6 +8633,32 @@ We set the prefix to the item's sigil, and trim off the sigil to get the text to
$prefix = substr $text, 0, 1;
$text = substr $text, 1;
+ my @out;
+
+=pod
+
+=item *
+
+We look for the lexical scope above DB::DB and auto-complete lexical variables
+if PadWalker could be loaded.
+
+=cut
+
+ if (not $text =~ /::/ and eval "require PadWalker; 1" and not $@ ) {
+ my $level = 1;
+ while (1) {
+ my @info = caller($level);
+ $level++;
+ $level = -1, last
+ if not @info;
+ last if $info[3] eq 'DB::DB';
+ }
+ if ($level > 0) {
+ my $lexicals = PadWalker::peek_my($level);
+ push @out, grep /^\Q$prefix$text/, keys %$lexicals;
+ }
+ }
+
=pod
=item *
@@ -8642,7 +8667,7 @@ If the package is C<::> (C<main>), create an empty list; if it's something else,
=cut
- my @out = map "$prefix$_", grep /^\Q$text/,
+ push @out, map "$prefix$_", grep /^\Q$text/,
( grep /^_?[a-zA-Z]/, keys %$pack ),
( $pack eq '::' ? () : ( grep /::$/, keys %:: ) );
diff --git a/pod/perldebug.pod b/pod/perldebug.pod
index 3ba73e8..cf1fa23 100644
--- a/pod/perldebug.pod
+++ b/pod/perldebug.pod
@@ -1066,9 +1066,9 @@ have full editing capabilities much like GNU I<readline>(3) provides.
Look for these in the F<modules/by-module/Term> directory on CPAN.
These do not support normal B<vi> command-line editing, however.
-A rudimentary command-line completion is also available.
-Unfortunately, the names of lexical variables are not available for
-completion.
+A rudimentary command-line completion is also available, including
+lexical variables in the current scope if the C<PadWalker> module
+is installed.
Without Readline support you may see the symbols "^[[A", "^[[C", "^[[B",
"^[[D"", "^H", ... when using the arrow keys and/or the backspace key.
@@ -1104,7 +1104,7 @@ X<profile> X<profiling> X<profiler>
If you wish to supply an alternative debugger for Perl to run, just
invoke your script with a colon and a package argument given to the
B<-d> flag. The most popular alternative debuggers for Perl is the
-Perl profiler. Devel::DProf is now included with the standard Perl
+Perl profiler. Devel::DProf is included with the standard Perl
distribution. To profile your Perl program in the file F<mycode.pl>,
just type:
@@ -1113,7 +1113,8 @@ just type:
When the script terminates the profiler will dump the profile
information to a file called F<tmon.out>. A tool like B<dprofpp>,
also supplied with the standard Perl distribution, can be used to
-interpret the information in that profile.
+interpret the information in that profile. More powerful profilers,
+such as C<Devel::NYTProf> are available from the CPAN.
=head1 Debugging regular expressions
X<regular expression, debugging>
--
Perl5 Master Repository
-
[perl.git] branch blead, updated. GitLive-blead-1237-g20f91e4
by Steffen Mueller