add "trace *" and introduce a fragment using it to show backtracking
[scpubgit/DX.git] / lib / DX / ShellState.pm
index c2e9fd2..4374ba4 100644 (file)
@@ -24,7 +24,8 @@ sub trace_sub {
   sub {
     my ($tag, $thing) = @_;
     my ($part) = split /\./, $tag;
-    return unless $self->trace_these->{$part} or $ENV{DX_TRACE};
+    my $traces = $self->trace_these;
+    return unless $traces->{$part} or $traces->{'*'} or $ENV{DX_TRACE};
     my $dp = deparse($thing);
     $dp =~ s/\n$//;
     warn "${dp}\n";
@@ -35,9 +36,9 @@ sub with_trace_changes {
   my ($self, @changes) = @_;
   my %trace = %{$self->trace_these};
   foreach my $change (@changes) {
-    if ($change =~ /^\+?(\w+)/) {
+    if ($change =~ /^\+?(\S+)/) {
       $trace{$1} = 1;
-    } elsif ($change =~ /^-(\w+)/) {
+    } elsif ($change =~ /^-(\S+)/) {
       delete $trace{$1};
     }
   }