データフォームデータベースを選択して表示したいのですが、以下のような問題があります。Can't call method "fetchrow_array" without a package or object reference
test.pl
my $q = new CGI();
my $handle = Db::connection();
sub select{
my $rData = {
table => 'student',
condition => {
ID => 100,
}
};
return Db::select($rData);
};
print $q->header;
print $q->start_html(
-title => "Main",
-style => {-src =>'/media/css/start/jquery-ui-1.10.3.custom.css" rel="stylesheet' },
-script => [
{ -src=>'/media/js/jquery-1.9.1.js'},
{ -src=>'/media/js/jquery-ui-1.10.3.custom.js'},
{ -src=>'/media/js/jquery.dataTables.js'},
]
);
my $cScript = qq{
\$(document).ready(function(){
oTable = \$('#id_table').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
});
\$("input[type=button], a, button")
.button()
.click(function( event ){
event.preventDefault();
});
});
};
print $q->script($cScript);
print start_form (-method => 'post', -action => "" );
my @aRows;
my $sqlSelect = Dbm::get_list({
table => 'personi',
condition => {
ID => 100,
}
});
while (my @data = $sqlSelect->fetchrow_array()) {
my $cRowId = hidden('rowid', $data[0]);
my $bt1 = image_button({-src => '/media/images/delete_1.png',
-class => 'del',
-title => 'delete',
-name => 'delete',
-value => $data[0],
my $bt2 = image_button({-src => '/media/images/edit_1.png',-class => 'upd', -title => 'update', -name => 'update', -value => $data[0]});
push @aRows, ($cRowId, $q->Tr($q->td([$data[1], $data[2], $data[3], $bt1, $bt2])));
}
print $q->table({-border => '1px solid green',-align =>'center', -width => '100%', -id => 'id_table'},
thead($q->th(['Name', 'Surname', 'Age', 'Delete', 'Edit'])),
@aRows,
);
print $q->input({-type => 'button', -class => 'button', -onclick => "window.location.href='insert.pl';", -value => 'Shto'});
print $q->end_form;
print test_select();
どこに問題があるのか わかりません。私はこの言語が初めてで、助けが必要です