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        


In reply to Re: Help with Try::Tiny and Catalyst::Authentication::Realm::Progressive (local $@) by tye
in thread Help with Try::Tiny and Catalyst::Authentication::Realm::Progressive by ghenry

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.