in reply to Help with Try::Tiny and Catalyst::Authentication::Realm::Progressive
By running it through prove instead of just running it directly, you make it harder to understand the output. But...
my $ok = eval { $c->authenticate( { username => $user, password => $info->{password} + }, ); }; diag $@; diag $ok; [...] t/live_app_realms_progressive.t t/live_app_realms_progressive.t .. # # undef [...] # # undef
Shows that the eval is failing (setting $ok to undef) but also leaving $@ as the empty string. Devel::EvalError explains how this can happen -- some of this has changed in the most recent versions of Perl (somewhat for the better, somewhat for the worse).
Devel::EvalError will even add a __DIE__ handler for you so that you can see the lost $@ value. The syntax of that module is stupidly ugly (the author was foolishly thinking that he had to avoid 'try { ... }' syntax because you can't "return" from it when the fact is that you can't "return" from 'eval { ... }' in exactly the same way and what he needed to avoid was only the obnoxious 'catch { ... }' syntax), so you can also just add your own __DIE__ handler simply enough.
Update: Oops. That is only one possible explanation. But it is more likely that the method call is just returning undef. I'd write that as:
my $res; my $ok= eval { $res= $c->...; 1; };
so the distinction is clear.
- tye
|
|---|