Graph-Reader-UnicodeTree
view release on metacpan or search on metacpan
UnicodeTree.pm view on Meta::CPAN
chomp $line;
# Remove indent.
my $parseable_line = substr $line, $indent[-1]->[0];
# Split to vertexes.
my @new_indent;
my @vertexes;
my $new_indent = $indent[-1]->[0];
my $last_indent;
foreach my $new_block (split m/$GR_TREE/ms, $parseable_line) {
if (defined $last_indent) {
push @new_indent, $last_indent;
$last_indent = undef;
}
my $last_vertex;
foreach my $new_vertex (split m/$GR_LINE/ms, $new_block) {
push @vertexes, $new_vertex;
$last_vertex = $new_vertex;
}
$new_indent += (length $new_block) + 3;
$last_indent = [$new_indent, $last_vertex];
}
# Add vertexes and edges.
my $first_v;
if (defined $indent[-1]->[1]) {
( run in 1.643 second using v1.01-cache-2.11-cpan-71847e10f99 )