Help for this page

Select Code to Download


  1. or download this
    $password= secret(...);
    ...
    local $password->{stringify_mask}= undef if ref($password) eq 'Crypt::
    +SecretBuffer';
    $db= DBI->connect($dsn, $user, $password, \%attr);
    
  2. or download this
    if ($password isa 'Crypt::SecretBuffer') {
      $db= $password->apply(sub { DBI->connect($dsn, $user, $_[0], \%attr)
    + });
    else {
      $db= DBI->connect($dsn, $user, $password, \%attr);
    }
    
  3. or download this
    if (blessed $password && $password->can("unmask_secret_to")) {
      $db= $password->unmask_secret_to(\&DBI::connect, 'DBI', $dsn, $user,
    + $password, \%attr);
    } else {
      $db= DBI->connect($dsn, $user, $password, \%attr);
    }
    
  4. or download this
    $db= DBI->connect($dsn, $user, ref $password? $$password : $password, 
    +\%attr);