These routines take a block as their first argument and only warn+Dumper the
results of the block. Dwarn_only is list context and simply provides @_,
DwarnS_only also does local $_ for the argument in order to simplify usage.
@EXPORT = qw(Dwarn DwarnS);
+@EXPORT_OK = qw(Dwarn_only DwarnS_only);
+
sub Dwarn { warn Data::Dumper::Concise::Dumper @_; @_ }
sub DwarnS ($) { warn Data::Dumper::Concise::Dumper $_[0]; $_[0] }
+sub Dwarn_only (&@) {
+ my $only = shift;
+ warn Data::Dumper::Concise::Dumper $only->(@_);
+ @_
+}
+
+sub DwarnS_only (&$) {
+ my $only = shift;
+ warn Data::Dumper::Concise::Dumper do { local $_ = $_[0]; $only->($_[0]) };
+ $_[0]
+}
+
=head1 NAME
Data::Dumper::Concise::Sugar - return Dwarn @return_value
--- /dev/null
+use strict;
+use warnings FATAL => 'all';
+use Test::More qw(no_plan);
+
+use Devel::Dwarn qw(Dwarn_only DwarnS_only);
+
+warn Dwarn_only { $_[0] } qw(one two three);
+
+warn DwarnS_only { $_->[0] } [ qw(one two three) ];