On Sat, Jul 07, 2007 at 09:09:42PM +0300, Philip Stoev wrote:
> Hello,
> 
> The DBI documentation says
> 
> "As a convenience, if the $data_source parameter is undefined or empty, the
> DBI will substitute the value of the environment variable DBI_DSN. If just
> the driver_name part is empty (i.e., the $data_source prefix is "dbi::"),
> the environment variable DBI_DRIVER is used. If neither variable is set,
> then connect dies."
> 
> Why does connect() have to die even if RaiseEror = 0? Wouldn't it be better
> to have $DBI::errstr = 'Can't connect to data source , no database driver
> specified and DBI_DSN env var not set'?
> 
> Sorry if this has been discussed previously, I could not find any mention of
> that isssue in the archives.

It's a bit subtle. $DBI::errstr isn't a normal variable, it's tied to
code that calls the errstr method on the "last DBI handle used".

If DBI->connect can't identify a driver to use then there's no 'last handle'.

Tim.

p.s.  It probably be faked with a dummy handle but doesn't seem worth the 
effort.

Reply via email to