can()
$handle->can($method_name)This function returns true if the method named is implemented by the
driver. You can use this method within a program to determine whether
a method for a handle is available. In the following example, after
starting the program and setting the database and statement handles,
we use the can() method:
...
my @methods = qw(fetchrow_array fetchrow_arrays);
foreach $method(@methods) {
if($sth->can($method)) { print "\$sth->$method is implemented.\n"; }
else { print "\$sth->$method is not implemented.\n\n"; }
}Here are the results from running this part of the program. Notice that the second, fictitious method named is not available:
$sth->fetchrow_array is implemented. $sth->fetchrow_arrays is not implemented.