JSON-JSONFold
view release on metacpan or search on metacpan
lib/JSON/JSONFold.pm view on Meta::CPAN
$d[F_LEAFS] = 0;
$d[F_FOLD_OK] = 1;
$d[F_GRID_OK] = 0 ;
$d[F_CHILD_NESTING] = -1;
return bless \@d, $class;
}
sub is_empty { return @{ $_[0][F_LINES] } == 0 }
sub last_line { return $_[0][F_LINES][-1] }
sub update_stats {
my ($self, $line) = @_ ;
$self->[F_ITEMS] += $line->[L_ITEMS];
$self->[F_LEAFS] += $line->[L_LEAFS];
$self->[F_PARTS_LENGTH] += $line->[L_PARTS_LENGTH] + ($self->[F_PARTS_LENGTH] ? 1 : 0) ;
if ($line->[L_CHILD_NESTING] >= $self->[F_CHILD_NESTING]) {
$self->[F_CHILD_NESTING] = $line->[L_CHILD_NESTING] + 1;
}
return ;
}
( run in 1.393 second using v1.01-cache-2.11-cpan-bbe5e583499 )