Carrot
view release on metacpan or search on metacpan
lib/Carrot/Individuality/Controlled/Customized_Settings/Structure/Table/Format/Aggregated_MxOxN.pm view on Meta::CPAN
package Carrot::Individuality::Controlled::Customized_Settings::Structure::Table::Format::Aggregated_MxOxN
# /type class
# //parent_classes
# [=component_pkg=]::_Corporate
# /capability ""
{
use strict;
use warnings 'FATAL' => 'all';
my $expressiveness = Carrot::individuality;
$expressiveness->package_resolver->provide(
my $line_class = '[=this_pkg=]::Line');
sub IDX_ROW_M() { 0 }
sub IDX_ROW_OXN() { 1 }
# =--------------------------------------------------------------------------= #
sub table_line_constructor
# /type method
# /effect "Fills an newly constructed instance with life."
# //parameters
# first_line
# //returns
# ::Personality::Abstract::Instance
{
return($line_class->indirect_constructor($_[SPX_FIRST_LINE]));
}
sub unquote_row
# /type method
# /effect ""
# //parameters
# row
# //returns
{
my ($this, $row) = @ARGUMENTS;
$row->[ADX_FIRST_ELEMENT] = $this->unquote_multiline_element(
$row->[ADX_FIRST_ELEMENT], ADX_FIRST_ELEMENT);
foreach my $subrow (@{$row->[ADX_SECOND_ELEMENT]})
{
$subrow->[ADX_FIRST_ELEMENT] = undef;
for (my $i = ADX_SECOND_ELEMENT; $i <= $#$subrow; $i++)
{
$subrow->[$i] = $this->unquote_multiline_element(
$subrow->[$i], $i);
}
}
return;
}
sub parse_lines
# /type method
# /effect ""
# //parameters
# cursor
# line
# //returns
{
my ($this, $cursor, $line) = @ARGUMENTS;
my $one_xoxn = IS_UNDEFINED;
my $oxn = IS_UNDEFINED;
my $context = '';
my ($type, $elements);
while ($cursor->advance)
{
if ($line->is_end_body)
{
if (defined($one_xoxn))
{
$this->row_action($context, $one_xoxn);
}
last;
} elsif ($line->is_cut)
{
$this->drop_rows;
$one_xoxn = IS_UNDEFINED;
next;
} elsif (my $element = $line->is_next_subrow)
{
unless (defined($one_xoxn))
{
die("Can't start next subrow without an initial subrow.");
}
push($one_xoxn->[0], $element);
$oxn = [map([], @$elements)];
push($one_xoxn->[1], $oxn);
next;
} elsif ($line->is_next_row)
{
if (defined($one_xoxn))
{
$this->row_action($context, $one_xoxn);
}
$one_xoxn = IS_UNDEFINED;
next;
}
($type, $elements) = $line->must_be_data;
if (defined($one_xoxn))
{
unless ($context eq $type)
{
die("Context '$context' and start '$type' mismatch");
}
} else {
$context = $type;
$oxn = [map([], @$elements)];
$one_xoxn = [[], [$oxn]];
}
push($one_xoxn->[0], $elements->[0]);
foreach my $i (1 .. $#$oxn)
{
push($oxn->[$i], $elements->[$i]);
}
}
return;
}
sub add_row
# /type method
( run in 3.034 seconds using v1.01-cache-2.11-cpan-5a3173703d6 )