GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  NGINX::SIMPLE::DISPATCH (3)

.ds Aq ’

NAME

Nginx::Simple::Dispatch - Easy to use dispatcher interface for "--with-http_perl_module"

CONTENTS

SYNOPSIS

For an instant working example please see the ./testdrive-example directory.

MainPage.pm:



   package MainPage;

   # app_path is where the applications URI begins
   # auto_import allows for lazyloading of application modules
   use Nginx::Simple::Dispatch( app_path => /foo, auto_import => 1 );
   use strict;

   sub index :Index {
       my $self = shift;

       $self->print(I am the main page people will see.);
   }

   sub about :Action {
       my $self = shift;

       $self->print(Let us pretend the about page goes here, shall we?);
   }

   sub error {
       my $self = shift;
       my $self->get_error;
       my @stack = $self->error_stack;

       $self->status(500);
       $self->print(Something blew up! Kaboooooom!<hr>);
       $self->print("Details: <pre>$error</pre>");

       $self->cleanup;
   }

   sub bad_dispatch {
       my $self = shift;
       my $error = shift;

       $self->status(404);
       $self->print(Page not found.);
   }

   # do something after we do something
   sub cleanup
   {
       warn "[looging dragons: good]\n";
   }

   1;



MainPage/weather.pm



   package MainPage::weather;

   use base MainPage;
   use strict;

   sub index :Index {
       my $self = shift;

       $self->print("zap zap ook");
   }

   sub corn :Action {
       my $self = shift;

       $self->print("men");
   }

   1;



Author

Michael J. Flickinger, <mjflick@gnu.org>

Copyright & License

You may distribute under the terms of either the GNU General Public License or the Artistic License.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 NGINX::SIMPLE::DISPATCH (3) 2011-02-18

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.