in reply to Re: Devel::Peek output to a string?
in thread Devel::Peek output to a string?

If the above routine is run on certain *nixes (but not Windows), each call to the above subroutine will print out a "Use of uninitialized value in subroutine" warning along with the dump.

This is apparently due to a bug in Devel::Peek::Dump (see my note below). To eliminate the warning on those systems you will need to make the following change to the subroutine suggested by repellent:

sub dump_as_str { my $str; # redirect STDERR temporarily open(my $ORIGSTDERR, ">&", STDERR) and close(STDERR) and open(STDERR, ">", \$str) or die($!); #----------------------------------------------------- #revision to suppress warnings - see bug report #63498 #----------------------------------------------------- #Dump($_[0]); { no warnings 'uninitialized'; Dump($_[0]); } # restore STDERR open(STDERR, ">&=" . fileno($ORIGSTDERR)) or die($!); return $str; }

Best beth