G'day pablor,
Welcome to the Monastery.
"I found that I can handle that by using eval{} Is that the best approach?"
I find Try::Tiny can be a better approach. It's DESCRIPTION starts:
"This module provides bare bones try/catch/finally statements that are designed to minimize common mistakes with eval blocks, and NOTHING else."
Using eval can have some issues. See the BACKGROUND section of Try::Tiny for a discussion of these issues. As you haven't shown how you're using eval, I can't say whether any of those issues apply to you.
There's lots of similar modules available, for instance, try CPAN Search for Try::.
"it seems that is running much slower when I use eval." [my emphasis]
Use Benchmark to compare speeds. I recommend running it several times; five is usual for me.
— Ken
In reply to Re: Handling Exceptions on Net::SSH::Expect
by kcott
in thread Handling Exceptions on Net::SSH::Expect
by pablor
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |