jcpunk has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to add some more helpful behavior to an existing script that is DBI dependent. On systems without DBI it complains about how DBI.pm is not found and so on.
Some of what it is supposed to do is not DBI dependend (basic stats gathering), what I want to do is run the non-DBI stuff anyway....
I thought I had it figured out, but... here is what I have tried. It still complains of no DBI module when there is none and refuses to run due to missing modules...
help?$use_dbi = 1; eval("use DBI;"); $use_dbi = 0 if (not($@); if ($use_dbi) { use DBI; ... } else { print "NO DBI\n"; } ... do other stuff ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBI detector?
by davidrw (Prior) on Apr 03, 2006 at 20:41 UTC | |
by jcpunk (Friar) on Apr 03, 2006 at 20:56 UTC | |
by ikegami (Patriarch) on Apr 03, 2006 at 21:19 UTC | |
by davidrw (Prior) on Apr 04, 2006 at 00:30 UTC | |
by ikegami (Patriarch) on Apr 04, 2006 at 05:21 UTC | |
|
Re: DBI detector?
by ikegami (Patriarch) on Apr 03, 2006 at 20:01 UTC | |
by jcpunk (Friar) on Apr 03, 2006 at 20:18 UTC | |
by ikegami (Patriarch) on Apr 03, 2006 at 20:31 UTC | |
by jcpunk (Friar) on Apr 03, 2006 at 20:43 UTC | |
by ikegami (Patriarch) on Apr 03, 2006 at 21:13 UTC |