Re: Perl+DBI question [C1]
On 2008-07-28 20:36:23 +0530, Srinivas KATTI wrote: I am working on perl assignment which is first perl code in our environment, i have come across following problem, pls if you could provide your expert consultansy it will be great help to me I am trying to use DBI in my program (simple program), below is the piece of code #!/usr/bin/perl -w #use lib '/tools/dev/perl_modules/DBI/1.48/DBI-1.48'; BEGIN { push @INC,/tools/dev/perl_modules/DBI/1.48/DBI-1.48; } use DBI; [...] when i execute the above program, get the following error Can't locate loadable object for module DBI in @INC On some OSs (notably Solaris) it isn't possible to change the search path for shared libraries after the program has been loaded. (@INC contains: /usr/perl5/5.00503/sun4-solaris And I see you are running Solaris, so that might be an issue. You are also running an extremely old version of perl. If at all possible, upgrade to a current version: 5.10.0 or at least 5.8.8. [...] the comments specified in DBI.pm says # If you get an error here like Can't find loadable object ... # then you haven't installed the DBI correctly. Read the README # then install it again. So is this correct? do i need to install it again How did you install it? Normally, if you install a module, perl knows how to find it - no messing around with @INC necessary. If you need to do that, you have already done something strange (not necessarily wrong, but strange - so you may run into strange problems). hp -- _ | Peter J. Holzer| Am Anfang war der Bug und der |_|_) | Sysadmin WSR | Verantwortliche sprach: | | | [EMAIL PROTECTED] | Es werde ein Testcase. __/ | http://www.hjp.at/ |-- Clemens Zauner in dcii pgpIJ75f409tz.pgp Description: PGP signature
Re: Perl+DBI question [C1]
On Mon, Jul 28, 2008 at 08:36:23PM +0530, Srinivas KATTI wrote: Hi I am working on perl assignment which is first perl code in our environment, i have come across following problem, pls if you could provide your expert consultansy it will be great help to me I am trying to use DBI in my program (simple program), below is the piece of code #!/usr/bin/perl -w #use lib '/tools/dev/perl_modules/DBI/1.48/DBI-1.48'; BEGIN { push @INC,/tools/dev/perl_modules/DBI/1.48/DBI-1.48; I'd guess that you're refering to the directory you unpacked built the DBI in. Don't do that, it won't work. After perl Makefile.PL, make, and make test you should make install to install the appropriate files into the appropriate directories. You can change where the files get put using either the INSTALL_BASE=... or PREFIX=... arguments to perl Makefile.PL, See perldoc ExtUtils::MakeMaker for more information. Tim.
Re: Perl+DBI question [C1]
On Tue, Jul 29, 2008 at 6:05 PM, Tim Bunce [EMAIL PROTECTED] wrote: On Mon, Jul 28, 2008 at 08:36:23PM +0530, Srinivas KATTI wrote: Hi I am working on perl assignment which is first perl code in our environment, i have come across following problem, pls if you could provide your expert consultansy it will be great help to me I am trying to use DBI in my program (simple program), below is the piece of code #!/usr/bin/perl -w #use lib '/tools/dev/perl_modules/DBI/1.48/DBI-1.48'; BEGIN { push @INC,/tools/dev/perl_modules/DBI/1.48/DBI-1.48; I'd guess that you're refering to the directory you unpacked built the DBI in. Don't do that, it won't work. After perl Makefile.PL, make, and make test you should make install to install the appropriate files into the appropriate directories. You can change where the files get put using either the INSTALL_BASE=... or PREFIX=... arguments to perl Makefile.PL, See perldoc ExtUtils::MakeMaker for more information. Tim. Hi Tim, Can't we use PERL5LIB environment variable to specify non standard perl modules directories for compiling DBI as we do while running our program ? Regards, Amit Saxena
Re: Perl+DBI question [C1]
On Tue, Jul 29, 2008 at 06:10:30PM +0530, Amit Saxena wrote: On Tue, Jul 29, 2008 at 6:05 PM, Tim Bunce [EMAIL PROTECTED] wrote: On Mon, Jul 28, 2008 at 08:36:23PM +0530, Srinivas KATTI wrote: I am working on perl assignment which is first perl code in our environment, i have come across following problem, pls if you could provide your expert consultansy it will be great help to me I am trying to use DBI in my program (simple program), below is the piece of code #!/usr/bin/perl -w #use lib '/tools/dev/perl_modules/DBI/1.48/DBI-1.48'; BEGIN { push @INC,/tools/dev/perl_modules/DBI/1.48/DBI-1.48; I'd guess that you're refering to the directory you unpacked built the DBI in. Don't do that, it won't work. After perl Makefile.PL, make, and make test you should make install to install the appropriate files into the appropriate directories. You can change where the files get put using either the INSTALL_BASE=... or PREFIX=... arguments to perl Makefile.PL, See perldoc ExtUtils::MakeMaker for more information. Can't we use PERL5LIB environment variable to specify non standard perl modules directories for compiling DBI as we do while running our program ? Yes you can, but it appears that the above script is specifying the location of the DBI source, not the installation directory. You only need to specify PERL5LIB if you are installing in a non-standard place using PREFIX or similar incantation when building and installing. If you follow the standard ``perl Makefile.PL make make test make install'', then there is no need to set PERL5LIB. -- David Dooling http://www.politigenomics.com/
Perl+DBI question [C1]
Hi I am working on perl assignment which is first perl code in our environment, i have come across following problem, pls if you could provide your expert consultansy it will be great help to me I am trying to use DBI in my program (simple program), below is the piece of code #!/usr/bin/perl -w #use lib '/tools/dev/perl_modules/DBI/1.48/DBI-1.48'; BEGIN { push @INC,/tools/dev/perl_modules/DBI/1.48/DBI-1.48; } use DBI; use strict; my $dbh = DBI-connect( 'dbi:Sybase:SNYCTLDBD01', 'glrecadm', 'glrecadm', { RaiseError = 1, AutoCommit = 0 } ) || die Database connection not made: $DBI::errstr; $dbh-disconnect(); when i execute the above program, get the following error Can't locate loadable object for module DBI in @INC (@INC contains: /usr/perl5/5.00503/sun4-solaris /usr/perl5/5.00503 /usr/perl5/site_perl/5.005/sun4-solaris /usr/perl5/site_perl/5.005 . /tools/dev/perl_modules/DBI/1.48/DBI-1.48) at /tools/dev/perl_modules/DBI/1.48/DBI-1.48/DBI.pm line 254 BEGIN failed--compilation aborted at /tools/dev/perl_modules/DBI/1.48/DBI-1.48/DBI.pm line 254. BEGIN failed--compilation aborted at dbp.pl line 7. ** when i check the DBI.pm code [EMAIL PROTECTED]:[/tools/dev/perl_modules/DBI/1.48/DBI-1.48] ls -l DBI* -rwxr-xr-x 1 fftstroot 269772 Mar 14 2005 DBI.pm -rwxr-xr-x 1 fftst307 133636 Jan 20 2005 DBI.xs -rwxr-xr-x 1 fftst30720392 Dec 14 2004 DBIXS.h [EMAIL PROTECTED]:[/tools/dev/perl_modules/DBI/1.48/DBI-1.48] the comments specified in DBI.pm says # If you get an error here like Can't find loadable object ... # then you haven't installed the DBI correctly. Read the README # then install it again. So is this correct? do i need to install it again Or is it something that i am missing or not using correctly? Please do let me know if you need any other info to understand/trouble shoot my query Thanking you in advance Regards Srinivas Katti * This message and any attachments (the message) are confidential, intended solely for the addressee(s), and may contain legally privileged information. Any unauthorised use or dissemination is prohibited. E-mails are susceptible to alteration. Neither SOCIETE GENERALE nor any of its subsidiaries or affiliates shall be liable for the message if altered, changed or falsified. Ce message et toutes les pieces jointes (ci-apres le message) sont confidentiels et susceptibles de contenir des informations couvertes par le secret professionnel. Ce message est etabli a l'intention exclusive de ses destinataires. Toute utilisation ou diffusion non autorisee est interdite. Tout message electronique est susceptible d'alteration. La SOCIETE GENERALE et ses filiales declinent toute responsabilite au titre de ce message s'il a ete altere, deforme ou falsifie. *
Re: Perl+DBI question [C1]
On Mon, Jul 28, 2008 at 8:06 AM, Srinivas KATTI [EMAIL PROTECTED]wrote: I am working on perl assignment which is first perl code in our environment, i have come across following problem, pls if you could provide your expert consultansy it will be great help to me I am trying to use DBI in my program (simple program), below is the piece of code #!/usr/bin/perl -w #use lib '/tools/dev/perl_modules/DBI/1.48/DBI-1.48'; BEGIN { push @INC,/tools/dev/perl_modules/DBI/1.48/DBI-1.48; } Try /tools/dev/perl_modules -- Perl will add the sub-directories. See the other directories on @INC for examples. Or, maybe, you need to add blib to the end of the name you're using. If you haven't installed DBI yet, do so -- don't try to use it (or build any DBD modules) until it is installed. Doing that prevents this sort of headache. use DBI; use strict; my $dbh = DBI-connect( 'dbi:Sybase:SNYCTLDBD01', 'glrecadm', 'glrecadm', { RaiseError = 1, AutoCommit = 0 } ) || die Database connection not made: $DBI::errstr; $dbh-disconnect(); when i execute the above program, get the following error Can't locate loadable object for module DBI in @INC (@INC contains: /usr/perl5/5.00503/sun4-solaris /usr/perl5/5.00503 /usr/perl5/site_perl/5.005/sun4-solaris /usr/perl5/site_perl/5.005 . /tools/dev/perl_modules/DBI/1.48/DBI-1.48) at /tools/dev/perl_modules/DBI/1.48/DBI-1.48/DBI.pm line 254 BEGIN failed--compilation aborted at /tools/dev/perl_modules/DBI/1.48/DBI-1.48/DBI.pm line 254. BEGIN failed--compilation aborted at dbp.pl line 7. ** when i check the DBI.pm code [EMAIL PROTECTED]:[/tools/dev/perl_modules/DBI/1.48/DBI-1.48] ls -l DBI* -rwxr-xr-x 1 fftstroot 269772 Mar 14 2005 DBI.pm -rwxr-xr-x 1 fftst307 133636 Jan 20 2005 DBI.xs -rwxr-xr-x 1 fftst30720392 Dec 14 2004 DBIXS.h [EMAIL PROTECTED]:[/tools/dev/perl_modules/DBI/1.48/DBI-1.48] the comments specified in DBI.pm says # If you get an error here like Can't find loadable object ... # then you haven't installed the DBI correctly. Read the README # then install it again. So is this correct? do i need to install it again Or is it something that i am missing or not using correctly? Please do let me know if you need any other info to understand/trouble shoot my query -- Jonathan Leffler [EMAIL PROTECTED] #include disclaimer.h Guardian of DBD::Informix - v2008.0513 - http://dbi.perl.org Blessed are we who can laugh at ourselves, for we shall never cease to be amused.