arunvelusamy has asked for the wisdom of the Perl Monks concerning the following question:
Dear monks,
I am doing oo perl. I have a reference to a annonymous subroutine in a package "DbManager", and i want to call it in another package "addbook"(The reference is to be passed to HTML::pager). When i execute it, throws error. Can u help me. FYI rowCount works fine.
addbook package:my $get_db_data = sub { my ($offset,$per_page)=@_; my (@return_array, @data); connectDb() if(!$dbHandle); my $stmtHandle = $dbHandle->prepare("select id,name,address,email, +phone from ADDRESSBOOK limit $offset, $per_page"); $stmtHandle->execute(); while(@data = $stmtHandle->fetchrow_array()) { push(@return_array, [@data]); } $stmtHandle->finish(); $dbHandle->disconnect(); return \@return_array; };
Thanks in advance..... arunvelusamymy $pager = HTML::Pager->new(query=>$query, get_data_callback=>DbManager::get_db_data, rows=>DbManager->rowCount, page_size=>5, cell_space_color=>'#000000', cell_bacground_color=>'#ffffff', debug=>1 );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: [ooperl] calling reference to a annonymous sub
by Fang (Pilgrim) on Nov 07, 2005 at 08:40 UTC | |
by tphyahoo (Vicar) on Nov 07, 2005 at 09:45 UTC | |
by BUU (Prior) on Nov 07, 2005 at 10:29 UTC |