sub sendFile { # application object my $self = shift; # load template files my $tmpl = $self->param('info' => $self->load_tmpl('info.phtml')); ... } #### # get the filename my $filename = "dir+filename"; # check if file exist if(-e $filename){