From: Matt S Trout Date: Sat, 27 Feb 2016 21:25:00 +0000 (+0000) Subject: add trace primitive X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=372a400c5a9710eb519929f6a5579880576adb53;p=scpubgit%2FDX.git add trace primitive --- diff --git a/lib/DX/Utils.pm b/lib/DX/Utils.pm index 9c89107..b7a47f8 100644 --- a/lib/DX/Utils.pm +++ b/lib/DX/Utils.pm @@ -11,7 +11,7 @@ my @const = ( our @EXPORT_OK = ( @const, (my @builders = qw(step string number dict proposition)), - 'deparse', + 'deparse', 'trace', ); our %EXPORT_TAGS = ( @@ -42,6 +42,13 @@ our $VALUE_EXISTS = 1; our @VALUE_EXISTS = (EXISTENCE_OF(), INDICES_OF(), TYPE_OF(), CONTENTS_OF()); our @VALUE_SET = (INDICES_OF(), TYPE_OF(), CONTENTS_OF()); +sub trace { + my ($tag, $thing) = @_; + my $dp = deparse($thing); + $dp =~ s/\n//; + warn "${tag}: ${dp}\n"; +} + sub step { require DX::Step::Normal; DX::Step::Normal->new(@_);