added pre_dump
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 9 Aug 2009 18:56:04 +0000 (18:56 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 9 Aug 2009 18:56:04 +0000 (18:56 +0000)
lib/PXElator/html.pm
lib/PXElator/t/html.t

index 2ab9af4..00d5ff0 100644 (file)
@@ -1,5 +1,7 @@
 package html;
 
+use Data::Dump qw/dump/;
+
 sub table {
        my $cols = shift;
        my $th;
@@ -46,6 +48,14 @@ sub select {
        );
 }
 
+sub pre_dump {
+       my $data = shift;
+       my $dump = dump( $data );
+       $dump =~ s{"([^"]+)"(\s*=>)}{$1$2}gs;
+       $dump =~ s{"([^"]+)"}{"<b>$1</b>"}gs;
+       qq|<pre>$dump</pre>|;
+}
+
 warn "loaded";
 
 1;
index 10fc656..1f56df6 100755 (executable)
@@ -4,7 +4,7 @@ use warnings;
 use strict;
 use autodie;
 
-use Test::More tests => 4;
+use Test::More tests => 5;
 
 use_ok 'html';
 
@@ -16,3 +16,6 @@ diag $html;
 
 ok( $html = html::select( 'dropdown', 2, 1, 2, 3 ), 'select' );
 diag $html;
+
+ok( $html = html::pre_dump( foo => 1, bar => 'baz' ), 'pre_dump' );
+diag $html;