my $content = do {
open my $fh, '<', $file or die "Couldn't open $file: $!\n";
local $/ = undef;
<$fh>;
};
####
my $content;
{
open my $fh, '<', $file or die "Couldn't open $file: $!\n";
local $/ = undef;
$content = <$fh>;
}
##
##
my $content = sub {
my $file = shift;
open my $fh, '<', $file or die "Couldn't open $file: $!\n";
local $/ = undef;
return <$fh>;
}->($file);
##
##
ok 1;
{
my $mock = Test::MockModule->new('Foo');
$mock->redefine(bar => sub {...});
is baz(10), 42, 'baz gave correct answer to the universe with bar mocked.'
}
ok 3;