Hello World

NES directory installation .htaccess configuration


Options +ExecCGI
AddHandler cgi-script .cgi .pl

<FilesMatch \.(nsql|nes.cfg)$>
  order deny,allow
  deny from all
</FilesMatch> 

Each directory where NES templates are executed .htaccess configuration


AddHandler perl-nes .nhtml
AddHandler perl-nes .nhtm

# change for NES directory installation
Action perl-nes /cgi-bin/nes/dispatch.cgi

<FilesMatch \.(nsql|nes.cfg)$>
  order deny,allow
  deny from all
</FilesMatch> 

For the html/htm file add:
    
 AddHandler perl-nes .html
 AddHandler perl-nes .htm
 
With this configuration will run the script by:
http://sitio.com/archivo.nhtml

For:
http://sitio.com/archivo.cgi

Add:
    
Options +ExecCGI
AddHandler cgi-script .cgi .pl

Archivos nhtml y cgi


hello.nhtml:

{: NES 1.0 ('hello.cgi') :}
<html>
  <head>
    <title>Nes Hello World</title>
  </head>
  <body>
    <b>{: $ var_hello :}</b>
  </body>
</html>

The file should contain nhtml in the first line, first character, the script to be executed, or nothing, and will be displayed as a html file more.

hello.cgi:

use Nes;
# A Singleton object
my $nes = Nes::Singleton->new('hello.nhtml');

# A variable which stores information to be displayed in html
my $nes_tags = {};

$nes_tags->{'var_hello'} = 'Hello World!';


# Finally send the data to show
$nes->out(%$nes_tags);