Thread: Three versions of Pg.pm on my machine

Three versions of Pg.pm on my machine

From
Richard A Lough
Date:
Hi all,

This might be better posted to a perl newsgroup, if so,
please point me in the right direction.

I am running debian|testing and postgres 7.4.2, and I find
the following versions of Pg.pm on my machine.

# $Id:Pg.pm, v 1.1.1.1 2004.01.16 - 18166 bytes in
/usr/share/perl5/Pg.pm

package Class::DBI::Pg;
# $Id: Pg.pm v 1.15 2003.09.10 - 3419 bytes in
/usr/share/perl5/Class/DBI/Pg.pm

# $Id:Pg.pm v 1.92 2004.02.25 - 66285 bytes in
/usr/lib/Perl5/Pg.pm

I have sorted issues with Perl actually finding a script by
placing the "right" script early in Perl's search path.

When I run a perl script which includes '=connectdb('
sometimes I get a message telling me that the call to
connectdb has failed. This alerted me to the several
versions of Pg.pm on my machine. Version 1.92 has no
sub called connectdb. connectdb is found only in
version 1.1.1.1

I was hoping this problem would just go away. I find I
now have to do something about it. Probably a Perl
newsgroup would be the best place to ask, but I thought
I should ask here first in case I missed something.

Is it sensible to convert my scripts to use ver 1.92?

TIA

Richard A Lough




Re: Three versions of Pg.pm on my machine

From
"gnari"
Date:
[CC sent to richard@sheugh.com]
"Richard A Lough" <richard@sheugh.com> says:
>
> I am running debian|testing and postgres 7.4.2, and I find
> the following versions of Pg.pm on my machine.
>
> # $Id:Pg.pm, v 1.1.1.1 2004.01.16 - 18166 bytes in
> /usr/share/perl5/Pg.pm

this is probably supplied by the debian package
libpg-perl

>
> package Class::DBI::Pg;
> # $Id: Pg.pm v 1.15 2003.09.10 - 3419 bytes in
> /usr/share/perl5/Class/DBI/Pg.pm
this is another module alltogether (Class::DBI::Pg),
and you need not worry about this

>
> # $Id:Pg.pm v 1.92 2004.02.25 - 66285 bytes in
> /usr/lib/Perl5/Pg.pm
this does not seem to be supplied by a (current)
debian package according to packages.debian.org

what is the output of:
    # dpkg -S /usr/lib/Perl5/Pg.pm
?

> ... Probably a Perl
> newsgroup would be the best place to ask, but I thought
> I should ask here first in case I missed something.

I think the answer you are likely to get on a perl newsgroup
is to use DBI
   # apt-get install libdbd-pg-perl

gnari




Re: Three versions of Pg.pm on my machine

From
"gnari"
Date:
"Richard A Lough" <richard@sheugh.com> said on pgsql-general:
>
[discussion aboud different perl Pg.pm modules]

> > > /usr/lib/Perl5/Pg.pm
> Oops ...  should be /usr/lib/Perl5/DBD/Pg.pm

> packages installed are
> libdbi-perl 1.41-1
> libdbd-pg-perl 1.32-1

just to clarify:

you can either use DBI together with DBD::Pg
in that case the connection is made by something like
    use DBI;
    my $bdh = DBI->connect('bdi:Pg:dbname=foo','user','passwd');


or, you can use the Pg module. in that case:
    use Pg;
    my $conn=Pg::connectdb("dbname=foo");

this is supplied by the package libpg-perl

>
> On my current machine I installed a symlink some time ago and
> this points to the old version of Pg.pm. The symlink is found
> early in any search by a perl script, hence the new version
> of Pg.pm is not found. However, I am moving my stuff onto a
> new machine. This does not have the symlink, but the new Pg.pm
> is found and will not work with my scripts.

it can be tricky to use symlinks unless you know exactly
what you are doing. for example, libpg-perl also installs
/usr/lib/perl5/auto/Pg/Pg.so

I am still not exactly clear on what you are doing, but i
hope this helps

gnari



Re: Three versions of Pg.pm on my machine

From
Richard A Lough
Date:
> > # $Id:Pg.pm, v 1.1.1.1 2004.01.16 - 18166 bytes in
> > /usr/share/perl5/Pg.pm
>
> this is probably supplied by the debian package
> libpg-perl
>

> > # $Id:Pg.pm v 1.92 2004.02.25 - 66285 bytes in
> > /usr/lib/Perl5/Pg.pm
Oops ...  should be /usr/lib/Perl5/DBD/Pg.pm
> this does not seem to be supplied by a (current)
> debian package according to packages.debian.org
>
> what is the output of:
>     # dpkg -S /usr/lib/Perl5/Pg.pm
> ?
dpkg: -S /usr/lib/Perl5/DBD/Pg.pm


>
> > ... Probably a Perl
> > newsgroup would be the best place to ask, but I thought
> > I should ask here first in case I missed something.
>
> I think the answer you are likely to get on a perl newsgroup
> is to use DBI
>    # apt-get install libdbd-pg-perl
>
> gnari
>
packages installed are
libdbi-perl 1.41-1
libdbd-pg-perl 1.32-1

On my current machine I installed a symlink some time ago and
this points to the old version of Pg.pm. The symlink is found
early in any search by a perl script, hence the new version
of Pg.pm is not found. However, I am moving my stuff onto a
new machine. This does not have the symlink, but the new Pg.pm
is found and will not work with my scripts.

The solution seems to be to convert the scripts on the new
machine and to run my current setup until ready to change
over.

Thanks for your reply.

Richard A Lough