Just in case there is an error, this should be more explicit.
die "failed to setup string handle: $!\n";
binmode $fh;
my $bytes = $git->cat_blob($sha1, $fh);
die "failed to setup string handle: $!\n";
binmode $fh;
my $bytes = $git->cat_blob($sha1, $fh);
close $fh or die "failed to close string handle: $!\n";
close $fh or die "failed to close string handle: $!\n";
} else {
$str = `git cat-file blob $sha1`;
return if $? != 0 || length($str) == 0;
} else {
$str = `git cat-file blob $sha1`;
return if $? != 0 || length($str) == 0;