This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
overload.pm: Fix broken link
[perl5.git] / lib / assert.pl
index cfda70c..d47e006 100644 (file)
@@ -1,3 +1,11 @@
+warn "Legacy library @{[(caller(0))[6]]} will be removed from the Perl core distribution in the next major release. Please install it from the CPAN distribution Perl4::CoreLibs. It is being used at @{[(caller)[1]]}, line @{[(caller)[2]]}.\n";
+
+#
+# This library is no longer being maintained, and is included for backward
+# compatibility with Perl 4 programs which may require it.
+# This legacy library is deprecated and will be removed in a future
+# release of perl.
+#
 # assert.pl
 # tchrist@convex.com (Tom Christiansen)
 # 
@@ -16,6 +24,8 @@ sub assert {
 } 
 
 sub panic {
+    package DB;
+
     select(STDERR);
 
     print "\npanic: @_\n";
@@ -24,10 +34,11 @@ sub panic {
 
     # stack traceback gratefully borrowed from perl debugger
 
-    local($i,$_);
-    local($p,$f,$l,$s,$h,$a,@a,@sub);
+    local $_;
+    my $i;
+    my ($p,$f,$l,$s,$h,$a,@a,@frames);
     for ($i = 0; ($p,$f,$l,$s,$h,$w) = caller($i); $i++) {
-       @a = @DB'args;
+       @a = @args;
        for (@a) {
            if (/^StB\000/ && length($_) == length($_main{'_main'})) {
                $_ = sprintf("%s",$_);
@@ -41,10 +52,10 @@ sub panic {
        }
        $w = $w ? '@ = ' : '$ = ';
        $a = $h ? '(' . join(', ', @a) . ')' : '';
-       push(@sub, "$w&$s$a from file $f line $l\n");
+       push(@frames, "$w&$s$a from file $f line $l\n");
     }
-    for ($i=0; $i <= $#sub; $i++) {
-       print $sub[$i];
+    for ($i=0; $i <= $#frames; $i++) {
+       print $frames[$i];
     }
     exit 1;
 }