summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLarry Wall <lwall@netlabs.com>1991-06-06 23:28:14 +0000
committerLarry Wall <lwall@netlabs.com>1991-06-06 23:28:14 +0000
commit9ef589d8078fdf16316dec772c00e81b3c38fd22 (patch)
treee45650d2a4acb876fe2b249e8727e066c5be4c90 /lib
parent352d5a3ab0aab9889c59e847643d265e062cec0b (diff)
downloadperl-9ef589d8078fdf16316dec772c00e81b3c38fd22.tar.gz
perl 4.0 patch 8: patch #4, continued
See patch #4.
Diffstat (limited to 'lib')
-rw-r--r--lib/perldb.pl9
-rw-r--r--lib/shellwords.pl42
2 files changed, 49 insertions, 2 deletions
diff --git a/lib/perldb.pl b/lib/perldb.pl
index d7f05bfc82..8d1605426c 100644
--- a/lib/perldb.pl
+++ b/lib/perldb.pl
@@ -1,6 +1,6 @@
package DB;
-$header = '$Header: perldb.pl,v 4.0 91/03/20 01:25:50 lwall Locked $';
+$header = '$RCSfile: perldb.pl,v $$Revision: 4.0.1.1 $$Date: 91/06/07 11:17:44 $';
#
# This file is automatically included if you do perl -d.
# It's probably not useful to include this yourself.
@@ -10,6 +10,10 @@ $header = '$Header: perldb.pl,v 4.0 91/03/20 01:25:50 lwall Locked $';
# have a breakpoint. It also inserts a do 'perldb.pl' before the first line.
#
# $Log: perldb.pl,v $
+# Revision 4.0.1.1 91/06/07 11:17:44 lwall
+# patch4: added $^P variable to control calling of perldb routines
+# patch4: debugger sometimes listed wrong number of lines for a statement
+#
# Revision 4.0 91/03/20 01:25:50 lwall
# 4.0 baseline.
#
@@ -61,6 +65,7 @@ sub DB {
($package, $filename, $line) = caller;
$usercontext = '($@, $!, $[, $,, $/, $\) = @saved;' .
"package $package;"; # this won't let them modify, alas
+ local($^P) = 0; # don't debug our own evals
local(*dbline) = "_<$filename";
$max = $#dbline;
if (($stop,$action) = split(/\0/,$dbline{$line})) {
@@ -76,7 +81,7 @@ sub DB {
print OUT "$package'" unless $sub =~ /'/;
print OUT "$sub($filename:$line):\t",$dbline[$line];
for ($i = $line + 1; $i <= $max && $dbline[$i] == 0; ++$i) {
- last if $dbline[$i] =~ /^\s*(}|#|\n)/;
+ last if $dbline[$i] =~ /^\s*(;|}|#|\n)/;
print OUT "$sub($filename:$i):\t",$dbline[$i];
}
}
diff --git a/lib/shellwords.pl b/lib/shellwords.pl
new file mode 100644
index 0000000000..168991fa3f
--- /dev/null
+++ b/lib/shellwords.pl
@@ -0,0 +1,42 @@
+#; shellwords.pl
+#;
+#; Usage:
+#; require 'shellwords.pl';
+#; @words = &shellwords($line);
+#; or
+#; @words = &shellwords(@lines);
+#; or
+#; @words = &shellwords; # defaults to $_ (and clobbers it)
+
+sub shellwords {
+ package shellwords;
+ local($_) = join('', @_) if @_;
+ local(@words,$snippet,$field);
+
+ s/^\s+//;
+ while ($_ ne '') {
+ $field = '';
+ for (;;) {
+ if (s/^"(([^"\\]+|\\[\\"])*)"//) {
+ ($snippet = $1) =~ s#\\(.)#$1#g;
+ }
+ elsif (s/^'(([^'\\]+|\\[\\'])*)'//) {
+ ($snippet = $1) =~ s#\\(.)#$1#g;
+ }
+ elsif (s/^\\(.)//) {
+ $snippet = $1;
+ }
+ elsif (s/^([^\s\\'"]+)//) {
+ $snippet = $1;
+ }
+ else {
+ s/^\s+//;
+ last;
+ }
+ $field .= $snippet;
+ }
+ push(@words, $field);
+ }
+ @words;
+}
+1;