Subject: | Uninitialized value warning when no header Content-Type |
Date: | Thu, 17 Sep 2015 10:40:34 +0200 |
To: | bug-Catalyst-View-Download [...] rt.cpan.org |
From: | Mauritz Hansen <mauritzhansen [...] yapedi.com> |
Hi package maintainer,
I am using Catalyst::View::Download::HTML, version 0.5 in my Catalyst application, and I am getting the following warning:
Use of uninitialized value in string eq at /usr/local/share/perl/5.18.2/Catalyst/View/Download/HTML.pm line 30.
This is due to the fact that I have no Content-Type header. The following is a patch that will take care of the warning.
Regards,
Mauritz
__START PATCH__
*** HTML.pm 2015-09-17 10:26:57.348783879 +0200
--- /usr/local/share/perl/5.18.2/Catalyst/View/Download/HTML.pm 2015-09-17 10:28:00.280781412 +0200
***************
*** 28,34 ****
my $content = $self->render( $c, $template, $c->stash );
$c->res->headers->header( "Content-Type" => "text/html" )
! if ( $c->res->headers->header( "Content-Type" ) eq "" );
$c->res->body( $content );
}
--- 28,34 ----
my $content = $self->render( $c, $template, $c->stash );
$c->res->headers->header( "Content-Type" => "text/html" )
! unless $c->res->headers->header( "Content-Type" );
$c->res->body( $content );
}
__END PATCH__