For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > October 2005 > problem using a module









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author problem using a module
Jm

2005-10-28, 6:56 pm

i'm modifying a script to run on a sun box that i do not have
privileges to install modules in the normal perl paths. subsequently
i installed DBI.pm into a modules subdir under my home dir. below are
the 2 relevant lines:


use lib "$ENV{HOME}/modules/DBI";

our $mysql_dbh =3D DBI->connect("DBI:mysql:host=3Dx.x.x.x", "user",
"password", {RaiseError =3D> 1});


this is the error msg i get:

Can't modify subroutine entry in scalar assignment at ./ca-cisco line
64, near ");"

line 64 being the "our $mysql_dbh..." line (yes the host is a valid ip addr=
ess).

this does work on a linux box with DBI installed in the standard
location, so what do i need to do to get this to work where DBI is
recognized by the script but not in the normal location?
--
since this is a gmail account, please verify the mailing list is
included in the reply to addresses
Wiggins d'Anconia

2005-10-28, 6:56 pm

jm wrote:
> i'm modifying a script to run on a sun box that i do not have
> privileges to install modules in the normal perl paths. subsequently
> i installed DBI.pm into a modules subdir under my home dir. below are
> the 2 relevant lines:
>
>
> use lib "$ENV{HOME}/modules/DBI";
>
> our $mysql_dbh = DBI->connect("DBI:mysql:host=x.x.x.x", "user",
> "password", {RaiseError => 1});
>
>
> this is the error msg i get:
>
> Can't modify subroutine entry in scalar assignment at ./ca-cisco line
> 64, near ");"
>
> line 64 being the "our $mysql_dbh..." line (yes the host is a valid ip address).
>
> this does work on a linux box with DBI installed in the standard
> location, so what do i need to do to get this to work where DBI is
> recognized by the script but not in the normal location?


That seems like a very odd error. One thing I do notice is that you are
including "DBI" in the path to 'use lib'. This would have to mean that
the DBI module lives in "$ENV{HOME}/modules/DBI/DBI.pm". Is that the
case? Or should your use lib line just be "$ENV{HOME}/modules"??

HTH,

http://danconia.org

> --
> since this is a gmail account, please verify the mailing list is
> included in the reply to addresses
>

Xavier Noria

2005-10-28, 6:56 pm

On Oct 28, 2005, at 21:28, jm wrote:

> i'm modifying a script to run on a sun box that i do not have
> privileges to install modules in the normal perl paths. subsequently
> i installed DBI.pm into a modules subdir under my home dir. below are
> the 2 relevant lines:
>
>
> use lib "$ENV{HOME}/modules/DBI";
>
> our $mysql_dbh = DBI->connect("DBI:mysql:host=x.x.x.x", "user",
> "password", {RaiseError => 1});
>
>
> this is the error msg i get:
>
> Can't modify subroutine entry in scalar assignment at ./ca-cisco line
> 64, near ");"


Perl version?

-- fxn

Jm

2005-10-28, 6:56 pm

On 10/28/05, Wiggins d'Anconia <wiggins@danconia.org> wrote:

>
> That seems like a very odd error. One thing I do notice is that you are
> including "DBI" in the path to 'use lib'. This would have to mean that
> the DBI module lives in "$ENV{HOME}/modules/DBI/DBI.pm". Is that the
> case? Or should your use lib line just be "$ENV{HOME}/modules"??
>
> HTH,
>
> http://danconia.org
>



you're right; upon further reading (i'm still researching) i
discovered that discrepancy and removed the "/DBI", now i get


Can't locate loadable object for module DBI in @INC (@INC contains:
/asi/home/ca/jm5379/modules /usr/perl5/5.00503/sun4-solaris
/usr/perl5/5.00503 /usr/perl5/site_perl/5.005/sun4-solaris
/usr/perl5/site_perl/5.005 .) at /asi/home/ca/jm5379/modules/DBI.pm
line 254


which does show my dir prepended to @INC. looking just now in DBI.pm
i see the following notes a little above line 254:


# 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 i guess just copying the file isn't going to cut it this time. oh
well. thanks for the quick response. back to the drawing board.


--
since this is a gmail account, please verify the mailing list is
included in the reply to addresses
Wiggins d'Anconia

2005-10-28, 6:56 pm

jm wrote:
> On 10/28/05, Wiggins d'Anconia <wiggins@danconia.org> wrote:
>
>
>
>
>
> you're right; upon further reading (i'm still researching) i
> discovered that discrepancy and removed the "/DBI", now i get
>
>
> Can't locate loadable object for module DBI in @INC (@INC contains:
> /asi/home/ca/jm5379/modules /usr/perl5/5.00503/sun4-solaris
> /usr/perl5/5.00503 /usr/perl5/site_perl/5.005/sun4-solaris
> /usr/perl5/site_perl/5.005 .) at /asi/home/ca/jm5379/modules/DBI.pm
> line 254
>
>
> which does show my dir prepended to @INC. looking just now in DBI.pm
> i see the following notes a little above line 254:
>
>
> # 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 i guess just copying the file isn't going to cut it this time. oh
> well. thanks for the quick response. back to the drawing board.
>


Yep. Your best bet is to use CPAN to install the module. One of its
configuration parameters will allow you to specify a prefix of where to
install modules, specifically 'makepl_arg'.

Check the archives of this list or google for further information. How
to install modules into a non-standard location is a widely covered topic.

HTH,

http://danconia.org

>
> --
> since this is a gmail account, please verify the mailing list is
> included in the reply to addresses
>

Jm

2005-10-28, 6:56 pm

>
> Yep. Your best bet is to use CPAN to install the module. One of its
> configuration parameters will allow you to specify a prefix of where to
> install modules, specifically 'makepl_arg'.
>
> Check the archives of this list or google for further information. How
> to install modules into a non-standard location is a widely covered topic=

..
>
> HTH,
>
> http://danconia.org
>
>


thanks. i'm attempting that now and discovered that "make" is not in
my paths. i'm searching for it but this may be a lost cause on this
particular system unless i can get the powers that be to install what
i need for me - politics say this is not a likely scenario *g*

--
since this is a gmail account, please verify the mailing list is
included in the reply to addresses
Xavier Noria

2005-10-28, 6:56 pm

On Oct 28, 2005, at 21:59, jm wrote:

> On 10/28/05, Wiggins d'Anconia <wiggins@danconia.org> wrote:
>
>
>
>
> you're right; upon further reading (i'm still researching) i
> discovered that discrepancy and removed the "/DBI"


I don't understand this.

If the problem was that use lib pointed to the wrong directory, then

use DBI;

would fail and the compilation would be aborted with

Can't locate DBI.pm in @INC (@INC contains: ...

If you forgot to use DBI then the message would be:

Can't locate object method "connect" via package "DBI"
(perhaps you forgot to load "DBI"?)

But I can't reproduce the error message you sent. Anyone?

-- fxn

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com