Skip to content

Commit c9e372b

Browse files
committed
avoid using Data::Dumper for Perl OBJECT refs
Data::Dumper (at least as of 2.192, which is in the Perl git repo) doesn't support the new SVt_PVOBJ type, and generates a warning when it encounters it. It does actually return something, but the warning can be quite annoying. This commit special cases reftypes of 'OBJECT', avoiding use of Data::Dumper altogether.
1 parent d678dca commit c9e372b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/Type/Tiny.pm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ our @InternalPackages = qw(
7676
Type::Utils
7777
);
7878

79-
use Scalar::Util qw( blessed );
79+
use Scalar::Util qw( blessed reftype blessed );
8080
use Types::TypeTiny ();
8181

8282
our $SafePackage = sprintf 'package %s;', __PACKAGE__;
@@ -484,6 +484,7 @@ sub _dd {
484484

485485
!defined $value ? 'Undef'
486486
: !ref $value ? sprintf( 'Value %s', B::perlstring( $value ) )
487+
: reftype($value) eq 'OBJECT' ? sprintf( 'Object %s' . blessed( $value ) )
487488
: do {
488489
my $N = 0+ ( defined( $DD ) ? $DD : 72 );
489490
require Data::Dumper;

0 commit comments

Comments
 (0)