From: Arthur Axel 'fREW' Schmidt Date: Tue, 31 Aug 2010 02:27:41 +0000 (-0500) Subject: $DwarnN + Devel::ArgNames optional dep X-Git-Tag: v2.012~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FData-Dumper-Concise.git;a=commitdiff_plain;h=bef8cf5e5e01eadafefbd95cb99059a96faf73c7 $DwarnN + Devel::ArgNames optional dep --- diff --git a/Changes b/Changes index 89ee9ba..a24e278 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,7 @@ +2.011 Aug 30 2010 + - add $DwarnN export + - make Devel::ArgNames an optional dep + 2.010 Jul 29 2010 - add $Dwarn export diff --git a/Makefile.PL b/Makefile.PL index 3b0b40b..be54156 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -4,6 +4,5 @@ use strict; use warnings FATAL => 'all'; all_from 'lib/Data/Dumper/Concise.pm'; -requires 'Devel::ArgNames' => 0.03; WriteAll; diff --git a/lib/Data/Dumper/Concise.pm b/lib/Data/Dumper/Concise.pm index e9c7d4d..2a29056 100644 --- a/lib/Data/Dumper/Concise.pm +++ b/lib/Data/Dumper/Concise.pm @@ -2,7 +2,7 @@ package Data::Dumper::Concise; use 5.006; -$VERSION = '2.010'; +$VERSION = '2.011'; require Exporter; require Data::Dumper; diff --git a/lib/Data/Dumper/Concise/Sugar.pm b/lib/Data/Dumper/Concise/Sugar.pm index bbfdb6e..4b33717 100644 --- a/lib/Data/Dumper/Concise/Sugar.pm +++ b/lib/Data/Dumper/Concise/Sugar.pm @@ -4,22 +4,23 @@ use 5.006; use Exporter (); use Data::Dumper::Concise (); -use Devel::ArgNames; BEGIN { @ISA = qw(Exporter) } -@EXPORT = qw($Dwarn Dwarn DwarnS DwarnL DwarnN); +@EXPORT = qw($Dwarn $DwarnN Dwarn DwarnS DwarnL DwarnN); sub Dwarn { return DwarnL(@_) if wantarray; DwarnS($_[0]) } our $Dwarn = \&Dwarn; +our $DwarnN = \&DwarnN; sub DwarnL { warn Data::Dumper::Concise::Dumper @_; @_ } sub DwarnS ($) { warn Data::Dumper::Concise::Dumper $_[0]; $_[0] } sub DwarnN ($) { - my $x = arg_names(); + require Devel::ArgNames; + my $x = Devel::ArgNames::arg_names(); warn(($x?$x:'(anon)') . ' => ' . Data::Dumper::Concise::Dumper $_[0]); $_[0] } @@ -114,6 +115,10 @@ L, so see its docs for ways to make it do something else. $Dwarn = \&Dwarn +=head2 $DwarnN + + $DwarnN = \&DwarnN + =head2 DwarnL sub Dwarn { warn Data::Dumper::Concise::Dumper @_; @_ } @@ -126,6 +131,8 @@ L, so see its docs for ways to make it do something else. sub DwarnN { warn '$argname => ' . Data::Dumper::Concise::Dumper $_[0]; $_[0] } +B: this requires L to be installed. + =head1 TIPS AND TRICKS =head2 global usage diff --git a/t/dwarn.t b/t/dwarn.t index 5579c47..17790a7 100644 --- a/t/dwarn.t +++ b/t/dwarn.t @@ -8,4 +8,5 @@ use Test::More qw(no_plan); can_ok __PACKAGE__, qw{Dwarn DwarnS DwarnL DwarnN}; can_ok 'Devel::Dwarn', qw{Dwarn DwarnS DwarnL DwarnN}; -ok($Dwarn, 'Coderef gets exported too'); +ok($Dwarn, '$Dwarn gets exported'); +ok($DwarnN, '$DwarnN gets exported');