[dancer-users] Only even items

Stefan Hornburg (Racke) racke at linuxia.de
Mon Apr 8 20:18:40 BST 2013


On 04/08/2013 07:44 PM, Hugues Max wrote:
> Hello
> I've got stange problem with dancer with twitter boostrap
> I use
> 
> use Dancer::Plugin::Database;
> my $dbh = database({driver => 'mysql', database => 'asav'});
>  my %allCommandeBNP = database->quick_select('CommandeBNP', {} );
> 
> my @allCommandeBNP= %allCommandeBNP;
> my $allCommandeBNP=@allCommandeBNP;
> 
> In my mysql table has 36 items and $allCommandeBNP egal  36
> 
> I use
> 
>  if (params->{cmd} && params->{cmd} eq 'list') {
>                  return template 'template/navbar_login' => {
>                         username =>  params->{username},
>                         password =>  params->{password},
>                         tab      =>  3,
>                         ccmd => \%allCommandeBNP,
>                         show_list => "Liste des N° de commande:",
>                 };
>         }
> 
> 
> 
> and in my template
> 
> [%  FOREACH s IN ccmd.keys.sort %]
>              [% ccmd.$s.Ckey %]-
>         [%  END %]
> 
> the result is 18 items, one item on two and only even item
> 
> Liste des N° de commande: 210- 208- 206- 204- 202- 200- 198- 196- 194- 192- 190- 188- 186- 182- 184- 212- 214- 216-
> 
> On mysql.log  with request log activated , request is SELECT * FROM `CommandeBNP`
> 
> if someone has a idea ?

You assign the database result to a hash instead of an array, so 18 records end up as hash keys and 18 records
as hash values.

Regards
	Racke


-- 
LinuXia Systems => http://www.linuxia.de/
Expert Interchange Consulting and System Administration
ICDEVGROUP => http://www.icdevgroup.org/
Interchange Development Team



More information about the dancer-users mailing list