- create DwarnF for formatting Dumper'd output
+ - Create Ddie for die'ing output
2.012 Aug 31 2010
- Make DwarnN test still work if Devel::ArgNames isn't installed
BEGIN { @ISA = qw(Exporter) }
-@EXPORT = qw($Dwarn $DwarnN Dwarn DwarnS DwarnL DwarnN DwarnF);
+@EXPORT = qw(
+ $Dwarn $DwarnN Dwarn DwarnS DwarnL DwarnN
+ $Ddie $DdieN Ddie DdieS DdieL DdieN DdieD
+);
sub Dwarn { return DwarnL(@_) if wantarray; DwarnS($_[0]) }
sub DwarnF (&@) { my $c = shift; warn &Data::Dumper::Concise::DumperF($c, @_); @_ }
+sub Ddie { DdieL(@_) if wantarray; DdieS($_[0]) }
+
+our $Ddie = \&Ddie;
+our $DdieN = \&DdieN;
+
+sub DdieL { die Data::Dumper::Concise::Dumper @_ }
+
+sub DdieS ($) { die Data::Dumper::Concise::Dumper $_[0] }
+
+sub DdieN ($) {
+ require Devel::ArgNames;
+ my $x = Devel::ArgNames::arg_names();
+ die(($x?$x:'(anon)') . ' => ' . Data::Dumper::Concise::Dumper $_[0]);
+}
+
=head1 NAME
Data::Dumper::Concise::Sugar - return Dwarn @return_value
warn DumperF { "awesome: $_[0] not awesome: $_[1]" } $awesome, $cheesy;
return @return;
+If you want to immediately die after outputting the data structure, every
+Dwarn subroutine has a paired Ddie version, so just replace the warn with die.
+For example:
+
+ DdieL 'foo', { bar => 'baz' };
+
=head1 DESCRIPTION
use Data::Dumper::Concise::Sugar;
warn Dumper($return);
return $return;
+If you want to immediately die after outputting the data structure, every
+Dwarn subroutine has a paired Ddie version, so just replace the warn with die.
+For example:
+
+ DdieL 'foo', { bar => 'baz' };
+
=head1 TIPS AND TRICKS
=head2 global usage