in reply to callback function params

If you still can, consider using DBI together with DBD::SQLite instead. It is more commonly used and does not tie your application to SQLite.

Looking at the documentation of DB::SQLite, it seems that you are supposed to give it a callback like the following:

$db->select( $sql, sub { my ($sth) = @_; use Data::Dumper; print "I received the following statement handle: "; print Dumper $sth->fetchall_arrayref; });

Update: Fixed syntax errors in code

Replies are listed 'Best First'.
Re^2: callback function params
by azadian (Sexton) on May 26, 2024 at 14:14 UTC
    Thanks for the suggestion. Personally, I'd prefer to avoid DBD::SQLite, as it provides gobs more functionality than I need. For additional information, when I invoke Dumper(@_) in my callback subroutine, I get:
    $VAR1 = bless( {}, 'DBI::st' );
    When I try the proffered code, I get: Can't call method "fetchall_arrayref" on an undefined value.
      That looks like you omitted the my ($sth) = @_; line.
      Ooops! Found my problem. I simply didn't have $date in quotes, as SQL requires. Thanks for the help.

        Congratulations on the injection vulnerability; say hi to Bobby when he calls. Also you’re not avoiding DBI by using this module, you’re just adding a layer of 20 year old code over the top of the standard DB interface because it uses both it and DBD::SQLite.

        The cake is a lie.
        The cake is a lie.
        The cake is a lie.