CGI::Application::Structured::Tools::templates::create_controller.3pm

Langue: en

Version: 2010-05-03 (fedora - 01/12/10)

Section: 3 (Bibliothèques de fonctions)

NAME

Template controller creation helper for CGI::Application::Structured apps.

SYNOPSYS

     cd $PROJECT_ROOT_DIRECTORY
     
     ~/tmp/MyApp1$ perl script/create_controller.pl  --name="Conrtoller2"    
     will try to create lib/MyApp1/C
     Created lib/MyApp1/C/Conrtoller2.pm
     will try to create template directory templates/MyApp1/C/Conrtoller2
     Created templates/MyApp1/C/Conrtoller2
     Created templates/MyApp1/C/Conrtoller2/index.tmpl
 
 

DESCRIPTION

This will produce a subclass of your main application module, create a default runmode for it, and generate a default TT template for the default runmode. Restart server.pl and you can run that controller at:
    http://localhost:8060/cgi-bin/index.cgi/controller2
 
 

The result will be a page with the title ``controller2'' and an HTML H2 element with the text ``Hello world!''.

Also generate an index.tmpl for the new controller and puts it in the directory tree rooted in the 'templates' directory of the projects root directory. The directory structure of the 'templates' directory should mirror that of the path under 'lib' for the associated controller.

This script was generated by cas-starter.pl from CGI::Application::Structured::Tools package.

create_file($path, $contents)

Utility to create a file given it's path and desired contents.

get_template_path

Given a template name, finds it's full path in the CGI::Application::Structured::Tools template distribution.

create_submodule($module_name)

Given a partial module name, generates a module by prepending the applications main module name + ``::C::'' to $module_name to create the fully qualified package for the new controller module.

create_tt($module_name)

Given a module name it generates a Template Toolkit template for the 'index' runmode. The template is generated into the applications 'templates' directory. The nested directory structure reflects the director structure for your modules under the 'lib' directory.

Examples"

      gordon@govitoshi:~/tmp$ find MyApp1/lib/
      MyApp1/lib/
      MyApp1/lib/MyApp1.pm
      MyApp1/lib/MyApp1
      MyApp1/lib/MyApp1/C
      MyApp1/lib/MyApp1/C/Home.pm
      MyApp1/lib/MyApp1/C/Control2.pm
      MyApp1/lib/MyApp1/Dispatch.pm
 
      gordon@govitoshi:~/tmp$ find MyApp1/templates
      MyApp1/templates
      MyApp1/templates/MyApp1
      MyApp1/templates/MyApp1/C
      MyApp1/templates/MyApp1/C/Control2
      MyApp1/templates/MyApp1/C/Control2/index.tmpl
      MyApp1/templates/MyApp1/C/Home
      MyApp1/templates/MyApp1/C/Home/index.tmpl
 
 

AUTHOR

     Gordon Van Amburg
     CPAN ID: VANAMBURG
     vanamburg at cpan.org
 
 
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.