HTTP-headers

Description

With the HTTP-headers variable we have to define in our Perl script:

use Nes;
my $nes = Nes::Singleton->new('template.nhtml');
my $nes_tags = {};

$nes_tags->{'HTTP-headers'} = "Content-type: text/html\n\n";

$nes->out(%$nes_tags);

We can control the headers of the HTML output.

When Nes verifies that HTTP-headers has value, prints its content and not the headers by default. Should be included immediately after the NES Tag:

{: NES 1.0 ('file.pl') :}
{: $ HTTP-headers :}

If you define HTTP-headers and then not included with {: $ HTTP-headers :} we get an error.

Example

template.nhtml:

{: NES 1.0 ('file.pl') :}
{: $ HTTP-headers :}
<html>
  <head>
   ...
   

file.pl:
   
use Nes;
my = Nes::Singleton:Singleton->new('template.nhtml');
my $nes_tags = {};

$nes_tags->{'HTTP-headers'}  = "Cache-control: max-age=0\n";
$nes_tags->{'HTTP-headers'} .= "Cache-control: no-cache\n";
$nes_tags->{'HTTP-headers'} .= "Content-type: text/html\n\n";

$nes->out(%$nes_tags);