package DX::TraceFormatter;
use Scalar::Util qw(blessed);
-use curry;
use List::Util qw(min);
use DX::Class;
}
sub _format_indented {
- my ($self, $cb) = @_;
- return $cb->() if $WS eq ' ';
+ my ($self, $thing) = @_;
+ return $self->_format($thing) if $WS eq ' ';
our $Indent_Level;
local $Indent_Level = $Indent_Level + 1;
- my $unindented = $cb->();
+ my $unindented = $self->_format($thing);
(my $indented = $unindented) =~ s/^/${\$self->indent_by}/mg;
return $indented;
}
my ($self, $members) = @_;
join $WS,
'{[',
- (map $self->_format_indented($self->curry::_format($_)), @$members)
+ (map $self->_format_indented($_), @$members)
, ']}';
}
sub _format_as_dict {
my ($self, $members) = @_;
join $WS, '{{', (
- map $self->_format_indented($self->curry::_format(
+ map $self->_format_indented(
[ word_and_body => [ $_, $members->{$_} ] ],
- )), sort keys %$members
+ ), sort keys %$members
), '}}';
}
sub _format_as_list {
my ($self, $members) = @_;
join $WS, '{', (
- map $self->_format_indented($self->curry::_format($_)), @$members
+ map $self->_format_indented($_), @$members
), '}';
}
sub _format_as_pairs {
my ($self, $members) = @_;
join $WS, '{', (
- map $self->_format_indented($self->curry::_format(
+ map $self->_format_indented(
[ word_and_body => $_ ]
- )), @$members
+ ), @$members
), '}';
}
my ($self, $members) = @_;
join $WS, '{', (
join +($WS eq ' ' ? '; ' : $WS),
- map $self->_format_indented($self->curry::_format($_)), @$members
+ map $self->_format_indented($_), @$members
), '}';
}