title: Error handling on DBI->connect
body: <p>Besides handling error using standard code die "Unable to connect: $DBI::errstr\n" is it possible to write a custom code like below?</p>
  
  <h2>Standard:</h2>
  
  <pre><code>$dbstore = DBI-&gt;connect($dsn, $user, $pw,
      {ora_session_mode =&gt; $mode, PrintError =&gt; 0, RaiseError =&gt; 0, AutoCommit =&gt; 0}) 
      or die "Unable to connect: $DBI::errstr\n";
  </code></pre>
  
  <h2>Custom:</h2>
  
  <pre><code>$dbstore = DBI-&gt;connect($dsn, $user, $pw,
      {ora_session_mode =&gt; $mode, PrintError =&gt; 0, RaiseError =&gt; 0, AutoCommit =&gt; 0});
  
  if (!$dbstore)
  {
      CUSTOM_LOG_HANDLER("Could not connect to database: $DBI::errstr");
      return;
  }
  </code></pre>
  
  <h2>Sample Standard Code:</h2>
  
  <pre><code>#!/usr/bin/perl
  
  # PERL MODULES WE WILL BE USING
  use DBI;
  use DBD::mysql;
  
  # HTTP HEADER
  print "Content-type: text/html \n\n";
  
  # CONFIG VARIABLES
  $platform = "mysql";
  $database = "store";
  $host = "localhost";
  $port = "3306";
  $tablename = "inventory";
  $user = "username";
  $pw = "password";
  
  #DATA SOURCE NAME
  $dsn = "dbi:mysql:$database:localhost:3306";
  
  # PERL DBI CONNECT (RENAMED HANDLE)
  $dbstore = DBI-&gt;connect($dsn, $user, $pw) or die "Unable to connect: $DBI::errstr\n";
  </code></pre>
  
  <p>Thanks for you time.</p>