I think it depends; for this module I would do this since it returns the reference if successful.
local $@;
my $book = eval {
Spreadsheet::Read->new($file);
};
or
local $@;
my $book;
my $ok = eval {
$book = Spreadsheet::Read->new($file);
1;
};
The second example seems like "more work" to handle the error and is a lot messier. So in this case adding the "1" is superfulous since the called sub actually returns something (or doesn't).
A case where I'd use 1; with an or undef thrown in:
local $@;
my $ok = eval {
doSomethingButDontWantReturnValButCouldDie() or undef;
1;
};
I think ultimately, the answer is like I stated above,
it depends - on what you're doing and expecting; and how you tend to check for/handle exceptions.
I've also done this; but usually it's a game time decision for me.
local $@;
my $ok = eval {
doSomethingButDontWantReturnValButCouldDie();
1;
} or undef;