Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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
        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/ 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

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2023-12-11 10:04 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (41 votes). Check out past polls.