Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I track down the origin of Devel::Peek

Out-of-the-blue I started to see lines like this:

SV = PVIV(0x38fe3f0) at 0x3de5b80
  REFCNT = 1
  FLAGS = (PADMY)
  IV = 0
  PV = 0

These do not appear consistently and if I run the script repeatedly, with the same input, this output sometimes appear, sometimes even twice and sometimes not at all.

And every once in a while, the script hangs and displays an error message saying "Perl unfortunately stopped running."

It is obviously the output of Devel::Peek, but none of my modules uses it and the only CPAN modules I use are Log::Log4perl, Data::Dumper::AutoEncode (which of course uses Data::Dumper) and List::Util. All these I use extensively and I never got this kind of output.

Box: Win-7 Pro 64 bit

Summary of my perl5 (revision 5 version 18 subversion 2) configuration:

  Platform:
    osname=MSWin32, osvers=6.2, archname=MSWin32-x64-multi-thread
    uname='Win32 strawberry-perl 5.18.2.1 #1 Tue Jan  7 22:32:35 2014 x64'

Can someone suggest steps I could do to find the origin of this and why it happens?

Thanks

like image 675
MeirG Avatar asked Dec 11 '22 19:12

MeirG


1 Answers

At the top of your script, add the following:

BEGIN {
    use Carp qw( );
    use Devel::Peek qw( );
    my $old = \&Devel::Peek::Dump;
    my $new = sub { Carp::cluck("Devel::Peek::Dump got called somewhere!"); &$old };
    no warnings 'redefine';
    *Devel::Peek::Dump = $new;
}

This needs to happen before anyone imports Dump from Devel::Peek.

The output of Carp::cluck will include a stack trace.

like image 69
mob Avatar answered Jan 03 '23 05:01

mob