CGI::Application::Plugin::Nes - Nes templates in CGI::Application
use base 'CGI::Application::Plugin::Nes'; # compatibility with CGI.pm (slightly slower) # $ENV{CGI_APP_NES_BY_CGI} = 1; # require if exec by .cgi # $ENV{CGI_APP_NES_DIR} = '/full/path/to/cgi-bin/nes';
Plugin for use Nes templates in CGI::Application. You can use any Nes object or plugin in CGI::Application.
Include Nes Templates, PHP, PYTHON and others live sample:
L<http://nes.sourceforge.net/hello_nes/tests-cgiapp/index.cgi?action=Inludes>
Include Nes Objects live sample:
L<http://nes.sourceforge.net/hello_nes/tests-cgiapp/index.cgi?action=Objects>
Nes Tags and Debug Info live sample:
L<http://nes.sourceforge.net/hello_nes/tests-cgiapp/index.cgi?action=others>
In your .pm file instead of:
use base 'CGI::Application';
used:
use base 'CGI::Application::Plugin::Nes';
In addition to your myapp.cgi file, creates a nhtml file with the same name for the Top Nes template:
myapp.cgi:
use MyApp; my $app = MyApp->new(); $app->run(); 1; # in Nes cgi should return 1 as the pm files.
myapp.nhtml:
{: NES 1.0 ('myapp.cgi') :} <html> <head> ...
If you run your application by the CGI, you need to put the following variable the full path to Nes cgi-bin directory in your .pm or .cgi file:
$ENV{CGI_APP_NES_DIR} = '/full/path/to/cgi-bin/nes';
This is necessary for:
http://example.com/myapp.cgi
It is not necessary for:
http://example.com/myapp.nhtml
For compatibility with CGI.pm:
$ENV{CGI_APP_NES_BY_CGI} = 1;
It's a bit slower than letting to Nes handle the query. Not support for upload.
See http://cgi-app.org/index.cgi?LoginLogoutExampleApp
Code in CGI::Application::Plugin::Nes for a similar result:
package MinimalAppNes; use base 'CGI::Application::Plugin::Nes'; use strict; # require if exec by .cgi # $ENV{CGI_APP_NES_DIR} = '/full/path/to/cgi-bin/nes'; sub setup { my $self = shift; $self->start_mode('index'); $self->mode_param('action'); $self->run_modes( 'index' => 'index', 'logout' => 'logout', ); } sub index { my $self = shift; # only three lines of Perl script is necessary for generate form login my %nes_tags; $nes_tags{'action'} = 'login.nhtml'; Nes::Singleton->instance->out(%nes_tags); } sub logout { my $self = shift; my %nes_tags; $nes_tags{'action'} = 'logout.nhtml'; Nes::Singleton->instance->out(%nes_tags); }
In the instalation package see share/examples/compare directory
Skriptke: Enrique Castañón
Version 0.01
Copyright (c) Enrique F. Castanon Barbero. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://dev.perl.org/licenses/
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Use of this software in any way or in any form, source or binary, is not allowed in any country which prohibits disclaimers of any implied warranties of merchantability or fitness for a particular purpose or any disclaimers of a similar nature.
IN NO EVENT SHALL I BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION (INCLUDING, BUT NOT LIMITED TO, LOST PROFITS) EVEN IF I HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
Sample to use Nes; http://nes.sourceforge.net/, Nes, CGI::Application
1 POD Error
The following errors were encountered while parsing the POD:
Non-ASCII character seen before =encoding in 'Castañón'. Assuming UTF-8
To install CGI::Application::Plugin::Nes, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CGI::Application::Plugin::Nes
CPAN shell
perl -MCPAN -e shell install CGI::Application::Plugin::Nes
For more information on module installation, please visit the detailed CPAN module installation guide.