BEGIN { @ISA = qw(Exporter) }
-@EXPORT = qw(Dwarn DwarnS);
+@EXPORT = qw(Dwarn DwarnS DwarnL);
-sub Dwarn { warn Data::Dumper::Concise::Dumper @_; @_ }
+sub Dwarn { return DwarnL(@_) if wantarray; DwarnS($_[0]) }
+
+sub DwarnL { warn Data::Dumper::Concise::Dumper @_; @_ }
sub DwarnS ($) { warn Data::Dumper::Concise::Dumper $_[0]; $_[0] }
use Test::More qw(no_plan);
-can_ok __PACKAGE__, qw{Dwarn DwarnS};
+can_ok __PACKAGE__, qw{Dwarn DwarnS DwarnL};
-can_ok 'Devel::Dwarn', qw{Dwarn DwarnS};
+can_ok 'Devel::Dwarn', qw{Dwarn DwarnS DwarnL};
}
}
-my @foo = Dwarn 'warn', 'friend';
-is $warned_string,qq{"warn"\n"friend"\n}, 'Dwarn warns';
+DWARNL: {
+ my @foo = DwarnL 'warn', 'friend';
+ is $warned_string,qq{"warn"\n"friend"\n}, 'DwarnL warns';
-ok eq_array(\@foo, ['warn','friend']), 'Dwarn passes through correctly';
+ ok eq_array(\@foo, ['warn','friend']), 'DwarnL passes through correctly';
+}
+
+DWARNS: {
+ my $bar = DwarnS 'robot',2,3;
+ is $warned_string,qq{"robot"\n}, 'DwarnS warns';
+ is $bar, 'robot', 'DwarnS passes through correctly';
+}
-my $bar = DwarnS 'robot',2,3;
-is $warned_string,qq{"robot"\n}, 'DwarnS warns';
-is $bar, 'robot', 'DwarnS passes through correctly';
+DWARN: {
+ my @foo = Dwarn 'warn', 'friend';
+ is $warned_string,qq{"warn"\n"friend"\n}, 'Dwarn warns lists';
+
+ ok eq_array(\@foo, ['warn','friend']), 'Dwarn passes lists through correctly';
+
+ my $bar = Dwarn 'robot',2,3;
+ is $warned_string,qq{"robot"\n}, 'Dwarn warns scalars correctly';
+ is $bar, 'robot', 'Dwarn passes scalars through correctly';
+}