[Moose-commits] r7671 - in Mouse/trunk: . lib/Mouse

perigrin at code2.0beta.co.uk perigrin at code2.0beta.co.uk
Sat Feb 14 04:59:03 GMT 2009


Author: perigrin
Date: 2009-02-13 20:59:03 -0800 (Fri, 13 Feb 2009)
New Revision: 7671

Modified:
   Mouse/trunk/Changes
   Mouse/trunk/lib/Mouse/Object.pm
Log:
Add dump method from Moose::Object into Mouse::Object

Modified: Mouse/trunk/Changes
===================================================================
--- Mouse/trunk/Changes	2009-02-14 02:59:18 UTC (rev 7670)
+++ Mouse/trunk/Changes	2009-02-14 04:59:03 UTC (rev 7671)
@@ -3,6 +3,8 @@
 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
 

Modified: Mouse/trunk/lib/Mouse/Object.pm
===================================================================
--- Mouse/trunk/lib/Mouse/Object.pm	2009-02-14 02:59:18 UTC (rev 7670)
+++ Mouse/trunk/lib/Mouse/Object.pm	2009-02-14 04:59:03 UTC (rev 7671)
@@ -113,6 +113,13 @@
     }
 }
 
+sub dump { 
+    my $self = shift;
+    require Data::Dumper;
+    local $Data::Dumper::Maxdepth = shift if @_;
+    Data::Dumper::Dumper $self;
+}
+
 1;
 
 __END__
@@ -152,5 +159,20 @@
 You may put any business logic deinitialization in DEMOLISH methods. You don't
 need to redispatch or return any specific value.
 
+
+=head2 B<dump ($maxdepth)>
+
+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
 
+




More information about the Moose-commits mailing list