>>>>> "SB" == Steve Bertrand <[email protected]> writes:
SB> I thought afterword that it had to do with precedence. I'll stick to
SB> using brackets when I know I need the left side evaluated before moving
SB> forward.
you don't need parens (those aren't brackets, [] are brackets, {} are
braces) for that, just use the proper op eq and you get a better test
and the op is faster and binds better.
SB> I don't want to change the object method's behaviour just for a test, so
SB> can anyone point me in the right direction as to how I can override the
SB> object method's needed die() statement on the test side, so the method
SB> I'm testing doesn't die() the test?
you need to wrap the call in block eval and check for die
afterwards. see perldoc -f eval and perlvar for $...@. note that this is
BLOCK eval which is fine to use anywhere you want to trap dies and not
string eval which is evil unless absolutely necessary.
SB> is ($user->add_plan(\%plan_info), 0, "Don't want to die()!");
eval { $user->add_plan(\%plan_info) } ;
is( $@, .... ) ;
uri
--
Uri Guttman ------ [email protected] -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/