Help for this page

Select Code to Download


  1. or download this
    DBI->connect_cached( $dsn, $username, $auth, {
        PrintError => 1,
        RaiseError => 1,
        AutoInactiveDestroy => 1})or die "Could not connect to: " $DBI::er
    +rstr ."\n";
    
  2. or download this
    my $checkExist = $dbh->prepare("INSERT IGNORE INTO your statement here
    +");
    
    if (!$checkExist->execute()) {
        die "Error: ". $checkExist->errstr ."\n";
    }
    
  3. or download this
    use Try::Tiny;
    
    ...
        warn $_; # print the error (which Try::Tiny puts into $_)
        ... # do whatever you need to deal with the error
    };