dauhee has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I want to set the third parameter in a perl DBI function($allow_active) to true.
$sth = $dbh->prepare_cached($statement, \%attr, $allow_active);
I do not want to pass anything into second parameter. How do I do it? Thanks!

Replies are listed 'Best First'.
Re: Passing arguments
by TheoPetersen (Priest) on Feb 24, 2001 at 10:09 UTC
    Just use an undef for the second parameter: $sth = $dbh->prepare_cached($statement, undef, $allow_active);
Re: Passing arguments
by chipmunk (Parson) on Feb 24, 2001 at 23:54 UTC
    For DBI calls like this, where I don't want to specify any attributes, I just pass in an empty anonymous hash as the second argument: $sth = $dbh->prepare_cached($statement, {}, $allow_active);
Re: Passing arguments
by unixwzrd (Beadle) on Feb 24, 2001 at 09:11 UTC
    Your function will have three arguments passed to it. The $statement, a reference to %attr, and the $allow_active. You won't have to worry about $allow_active working its way into %attr.

    Mike - mps@discomsys.com

    "The two most common elements in the universe are hydrogen... and stupidity."
    Harlan Ellison