| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

FindEvalWarnings

This version was saved 16 years, 7 months ago View current version     Page history
Saved by David B
on September 9, 2007 at 8:27:16 pm
 

Find where the eval warning is coming from:

 

#!/usr/bin/perl

use strict;
use warnings; # This directive causes Perl to warn you about dubious coding
use Carp ();

# This overrides the way warnings work, "cluck"ing so you know the
# call stack at the time of the eval
local $SIG{__WARN__} = &Carp::cluck;

sub greetings { print "Hello" }

eval 'sub greetings { print "Hi" }';

 

Changing the warning handler (the line local $SIG...etc) changes this:

 

$ ./s.pl
Subroutine greetings redefined at (eval 1) line 1.

 

To this:

 

$ ./s.pl
Subroutine greetings redefined at (eval 1) line 1.
        eval 'sub greetings { print "Hi" }
;' called at ./s.pl line 11


 

 

Comments (0)

You don't have permission to comment on this page.