This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Protect me (and my fellow muppets) from screens of "syntax errors" if
authorNicholas Clark <nick@ccl4.org>
Sat, 5 Jan 2008 13:13:36 +0000 (13:13 +0000)
committerNicholas Clark <nick@ccl4.org>
Sat, 5 Jan 2008 13:13:36 +0000 (13:13 +0000)
one accidentally feeds embed.fnc or t/op/re_tests to the perl
interpreter.

p4raw-id: //depot/perl@32839

embed.fnc
t/op/re_tests
t/op/regexp.t

index d36e2fd..b11cd6e 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -1,3 +1,5 @@
+: BEGIN {die "You meant to run embed.pl"} # Stop early if fed to perl.
+:
 : Lines are of the form:
 :    flags|return_type|function_name|arg1|arg2|...|argN
 :
index 87a3e50..c2397e6 100644 (file)
@@ -1,3 +1,6 @@
+# This stops me getting screenfulls of syntax errors every time I accidentally
+# run this file via a shell glob
+__END__
 abc    abc     y       $&      abc
 abc    abc     y       $-[0]   0
 abc    abc     y       $+[0]   3
index 7ad7d89..8a13dd2 100755 (executable)
@@ -77,9 +77,9 @@ my $test;
 TEST:
 foreach (@tests) {
     $test++;
-    if (!/\S/ || /^\s*#/) {
+    if (!/\S/ || /^\s*#/ || /^__END__$/) {
         print "ok $test # (Blank line or comment)\n";
-        if (/\S/) { print $_ };
+        if (/#/) { print $_ };
         next;
     }
     chomp;