This one might work
my $cid=shift;
my $csth = $DB->table('Category')->select({ID => $cid});
my $crec = $csth->fetchrow_hashref();
my $db = $DB->table ('Category');
$db->select_options('ORDER BY Name DESC');
my $sth = $db->select ( { FatherID => $crec->{FatherID} });
my @cats;
while (my $cat = $sth->fetchrow_array)
{
unless ($cat->{ID} == $cid)
{
push @cats, $cat;
}
}
return {more_cats_loop=>\@cats};
}
Sacrifice is not about what you lose,
it is about what you gain in the process.
Code:
sub { my $cid=shift;
my $csth = $DB->table('Category')->select({ID => $cid});
my $crec = $csth->fetchrow_hashref();
my $db = $DB->table ('Category');
$db->select_options('ORDER BY Name DESC');
my $sth = $db->select ( { FatherID => $crec->{FatherID} });
my @cats;
while (my $cat = $sth->fetchrow_array)
{
unless ($cat->{ID} == $cid)
{
push @cats, $cat;
}
}
return {more_cats_loop=>\@cats};
}
Sacrifice is not about what you lose,
it is about what you gain in the process.