I've installed DBI
module via cpan
. CPAN has been configured to use local directory, so I have ~/perl5
and ~/.cpan
directories. The module apparently is in ~/.cpan/build/DBI-1.642-0
, which in fact does have DBI.pm
file there.
However, when I execute the following command as a test, the command suggests there is no "connect" object:
$ perl -e 'use lib qw( .cpan/build/DBI-1.642-0/ ); DBI->connect("dbi:SQLite:dbname=foo.sqlite","","");'
Can't locate object method "connect" via package "DBI" (perhaps you forgot to load "DBI"?) at -e line 1.
Environment: Debian-based distribution, perl 5.26.2 .
Note on possible duplicates:
- Can't locate object method via package subclassing DBI Asks about module subclassing, not what I'm doing
Addendum: From the discussion in the comments, it's clear that a lot of users focus on just use DBI
statement. As I've mentioned in the comments:
The whole goal is to make use of DBI module installed via cpan. Prior to installing DBD::SQLite neither use lib nor use DBI were giving a working solution. So the suggestion use DBI by itself was not useful.
Please note, I have tried both use DBI
and use lib qw()
methods prior to asking the question. The use DBI
line by itself was not effective without installing DBD::SQLite
module as mentioned in my answer.