Hi all, I've made a perl script that installs PostgreSQL, DBI and then DBD::Pg. Its does install Postgre and DBI correctly, but fails to install DBD::Pg. If I run the script a second time, it does install DBD::Pg correctly. I just dont understand why.
I'm running the script in sudo mode... here is a snippet from my code:
system("sudo aptitude update"); if ( $? == -1 ) { print "sudo aptitude update failed: $!\n"; exit; } system("sudo aptitude install postgresql-server-dev-8.3"); if ( $? == -1 ) { print "sudo aptitude install postgresql-server-dev-8.3 failed: $!\n" +; exit; } use CPAN; CPAN::Shell->install("DBI"); CPAN::Shell->install("DBD::Pg"); ----------
The first time, it fails with the following message:
Running make test
PGINITDB="/usr/lib/postgresql/8.3/bin/initdb" PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00-signature......skipped
        all skipped: Set the environment variable TEST_SIGNATURE to enable this test
t/00basic...........NOK 2
#   Failed test 'use DBD::Pg;
#   at t/00basic.t line 14.
#     Tried to use 'DBD::Pg'.
#     Error:  DBD::Pg object version undef does not match bootstrap parameter 2.15.1 at /usr/lib/perl/5.8/DynaLoader.pm line 245.
# Compilation failed in require at (eval 7) line 2.
# BEGIN failed--compilation aborted at (eval 7) line 2.
FAILED--Further testing stopped: Cannot continue without DBD::Pg
make: *** test_dynamic Error 9
  /usr/bin/make test -- NOT OK
Running make install
  make test had returned bad status, won't install without force.


Can somebody help me solve this problem ? I would like to understand why it works on the second run. Thank you for your help monks!

In reply to Trouble installing DBD::Pg by frankdew

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.