in reply to Cant locate DBI in @INC

You'd need to put the push (@INC, "D:\\Perl\\site\\lib"); in a BEGIN block for it to be of any help for the subsequent use DBI;.  Otherwise, the use DBI (which itself implies a BEGIN block) would be run before you have manipulated @INC.

BEGIN { push (@INC, "D:\\Perl\\site\\lib"); } use DBI;

Or simply

use lib "D:\\Perl\\site\\lib"; use DBI;

(The latter would also put the additional lib path in front of the array (like unshift @INC would) — which usually is what you want.)

Replies are listed 'Best First'.
Re^2: Cant locate DBI in @INC
by Irishboy24 (Sexton) on Sep 17, 2009 at 16:08 UTC

    i tried your way and it throws the following error

    $ perl data.pl 8 [main] perl 4524 _cygtls::handle_exceptions: Error while dumpi +ng state ( probably corrupted stack) Segmentation fault (core dumped)

      This shows that the @INC manipulation actually had an effect this time :)

      Unfortunately, the module that was found under D:\\Perl\\site\\lib apparently isn't binary compatible with your perl (most likely, the shared lib associated with the DBD part is the culprit).

      Anyhow, you said it did work before. So - as the @INC manipulation cannot have had any effect before - some other module must have been found at the time (under the default lib paths)... Maybe you can reconstruct which version/build of DBI/DBD and perl that had been.  Otherwise you'll likely have to reinstall the DB modules.