[Israel.pm] Alternative for catching return value

David Baird davidlbaird at gmail.com
Mon Nov 14 04:24:10 PST 2005


> eval {$sysUnderTest->someAction($foo, $bar, foo, bar)};
> die $@ if $@
>
> Will work if $sysUnderTest->someAction() trys to die if it fails.
> This should be the same as throwing a C++ exception

Since the methods call return their error codes in their return value,
this approach will not work. The module for the $sysUnderTest object
is already written, and the convention for returning errors already
established. I am seeking a simpler way of catching them in the test
scripts, which less than optimally skilled people will write and
maintain.

-David




More information about the Perl mailing list