use strict; use warnings; use DBI; my $dbh = DBI->connect('dbi:SQLite:dbname=xr.SQLite'); $dbh->do(<do(< $dbh}; $self->addSession(1, 2, 'Perl is fun', '2015-06-27'); $self->addSession(3, 4, 'SQL is fun', '2015-06-27'); $self->addSession(3, 5, 'SQL for fun and profit', '2015-06-20'); $self->addSession(4, 1, 'PerlMonks is great', '2015-06-20'); $self->addSession(2, 6, 'PerlMonks for fun and proffit', '2015-06-20'); my $active = $self->getActiveSessions(1, 2); print "$_->[1], $_->[2]: '$_->[3]'\n" for @$active; sub addSession { my ($self, $teacher, $learner, $topic) = @_; $self->{dbh}->do(<{dbh}->last_insert_id(undef, undef, undef, undef); $self->{dbh}->do(<{dbh}->do(<{dbh}->selectall_arrayref(<