Andreas J. Koenig wrote:
On Thu, 15 Nov 2007 13:01:09 +0000, David Cantrell <[EMAIL PROTECTED]> said:
> On Tue, Nov 13, 2007 at 12:15:47PM -0500, David Golden wrote:
>> Without delving closer into the specifics, you have two issues that
>> need to be separated:
>> (a) needing DBI to be installed to work at all
>> (b) needing to get information out of DBI for use in the make process
>> How do other DBD modules handle it? Or do they all just live with failures?
> I suggest replacing these lines in Makefile.PL:
> use DBI 1.21;
> use DBI::DBD;
> with:
> eval 'use DBI 1.21;use DBI::DBD' || eval q{
> use CPAN;
> CPAN::Shell->install("DBI");
> };
> eval 'use DBI 1.21;use DBI::DBD' || do {
> warn("Couldn't install DBI for some reason\n");
> exit 0;
> };
> Yes, it's ugly as hell :-)
And it's dangerous as the devil. It only works if all goes well but it
has unamusing effects if things do not DWYM and there are plenty of
reasons why they won't. I have watched more than once Module::Install
going into recursion and every lower level Module::Install started to
do the very same things as the previous instance. It needs a very
educated eye to understand where the desaster started.
I don't personally like this idea of installing stuff you have not got -
the simple reasons are in my original email - namely, in my experience
people do NOT run perl Makefile.PL in any elevated privilege mode (i.e.
not root) so the make and make test work fine then the install fails due
to permissions problems. I know you can add "sudo" etc to the make
install configuration in CPAN config but I don't think many people do.
Installing DBI when you have not got it, then failing will, in my
opinion just confuse the user - far better to say you cannot install
DBD::XXX because you have not got DBI - it is a simple error that means
something to most people.
Where David's suggestion wins out is when perl is being run as a
privileged user but in my experience this is not what the average user
does and in fact, if I'm not mistaken, there was a thread about this on
this list not so long ago. My aims were to:
1) not inconvenience or confuse the user installing DBD::ODBC if DBI was
not installed
2) pass cpan-testers tests or not fail because DBI was not installed or
an ODBC driver manager was not installed.
I think this lists advice has so far satisfied (2) and I don't think
I've changed (1). I am happy about this as no one has ever (to my
knowledge) complained about (1).
Martin