From: Chris Prather Date: Sat, 14 Feb 2009 04:59:03 +0000 (+0000) Subject: Add dump method from Moose::Object into Mouse::Object X-Git-Tag: 0.19~27 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=commitdiff_plain;h=df963a63491f0c26a26592d51534d5d440bc6f26 Add dump method from Moose::Object into Mouse::Object --- diff --git a/Changes b/Changes index 4f7561b..e38a1ce 100644 --- a/Changes +++ b/Changes @@ -3,6 +3,8 @@ Revision history for Mouse 0.17 * Load mro directly if Perl is recent enough (Nicholas Clark) + * Add dump method from Moose::Object into Mouse::Object (perigrin) + 0.16 Mon Feb 9 20:56:27 2009 * Implement get_all_method_names diff --git a/lib/Mouse/Object.pm b/lib/Mouse/Object.pm index 375cf60..d729261 100644 --- a/lib/Mouse/Object.pm +++ b/lib/Mouse/Object.pm @@ -113,6 +113,13 @@ sub DEMOLISHALL { } } +sub dump { + my $self = shift; + require Data::Dumper; + local $Data::Dumper::Maxdepth = shift if @_; + Data::Dumper::Dumper $self; +} + 1; __END__ @@ -152,5 +159,20 @@ L time. You may put any business logic deinitialization in DEMOLISH methods. You don't need to redispatch or return any specific value. + +=head2 B + +From the Moose POD: + + C'mon, how many times have you written the following code while debugging: + + use Data::Dumper; + warn Dumper $obj; + + It can get seriously annoying, so why not just use this. + +The implementation was lifted directly from Moose::Object. + =cut +