develooper Front page | perl.perl5.porters | Postings from December 2011

[PATCH] Test for "no strict;" in perl -d's evaluated lines

From:
Shlomi Fish
Date:
December 1, 2011 12:00
Subject:
[PATCH] Test for "no strict;" in perl -d's evaluated lines
Message ID:
20111201215745.2657834c@lap.shlomifish.org
Hi all,

this patch adds a test for perl -d to test for "no strict;" in the evaluated
lines. It was added as a result of a bug that was introduced while adding "use
strict;". It can be found here:

https://github.com/shlomif/perl/tree/perl-d-add-tests

Please apply it.

Regards,

	Shlomi Fish

diff --git a/lib/perl5db.t b/lib/perl5db.t
index 36dbcb8..28beddb 100644
--- a/lib/perl5db.t
+++ b/lib/perl5db.t
@@ -28,7 +28,7 @@ BEGIN {
     }
 }
 
-plan(16);
+plan(17);
 
 my $rc_filename = '.perldb';
 
@@ -98,6 +98,35 @@ like(_out_contents(), qr/sub factorial/,
 );
 
 {
+    my $target = '../lib/perl5db/t/eval-line-bug';
+
+    rc(
+        <<"EOF",
+    &parse_options("NonStop=0 TTY=db.out LineInfo=db.out");
+
+    sub afterinit {
+        push(\@DB::typeahead,
+            'b 23',
+            'c',
+            '\$new_var = "Foo"',
+            'x "new_var = <\$new_var>\\n";',
+            'q',
+        );
+    }
+EOF
+    );
+
+    {
+        local $ENV{PERLDB_OPTS} = "ReadLine=0";
+        runperl(switches => [ '-d' ], progfile => $target);
+    }
+}
+
+like(_out_contents(), qr/new_var = <Foo>/,
+    "no strict 'vars' in evaluated lines.",
+);
+
+{
     local $ENV{PERLDB_OPTS} = "ReadLine=0";
     my $output = runperl(switches => [ '-d' ], progfile =>
'../lib/perl5db/t/lvalue-bug'); like($output, qr/foo is defined/, 'lvalue subs
work in the debugger');


-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Funny Anti-Terrorism Story - http://shlom.in/enemy

Real programmers don’t write workarounds. They tell their users to upgrade
their software.

Please reply to list if it's a mailing list post - http://shlom.in/reply .



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About