Dancer2 icon indicating copy to clipboard operation
Dancer2 copied to clipboard

Sub pathname_exists makes debugging hard with the return eval {...} approach

Open kielstr opened this issue 7 years ago • 2 comments

Sub pathname_exists makes debugging hard with the return eval {...} approach . Just spent hours tracking down a problem with a custom login page for Dancer2::Plugin::Auth::Extensible. Turned out to be a rendering problem with the tt file. I strongly suggest a revisit to this method and am providing the following as a starting point to open the discussion...

sub pathname_exists {
    my ( $self, $pathname ) = @_;
    eval {        
        # dies if pathname can not be found via TT2's INCLUDE_PATH search
        $self->engine->service->context->template( $pathname );
        1;
    };

    if ($@) { 
      warn $@;
      return -1;
    }  
     
    return 1;
}

kielstr avatar May 30 '17 00:05 kielstr

Can you submit this as a pull request?

xsawyerx avatar Jun 09 '17 17:06 xsawyerx

Done

kielstr avatar Jun 18 '17 00:06 kielstr