How to read timeout of agi->get_data() perl

HI, I am unable to read timeout value. Could you plz help. I tried in different way it alway give “”.

my $result = $AGI->get_data($filename, $timeout, 1);
my $key = $result[‘result’];

$result = “” if !defined $result;
my $timeout = $agi->_lastresponse =~ /(timeout)/;
$key = “#” if ($result eq “” && !$timeout);

$AGI->set_variable($variable, $key);

Thanks in advance.