Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

cgi::application::plugin::autorunmode::filedelegate(3pm) [debian man page]

AutoRunmode::FileDelegate(3pm)				User Contributed Perl Documentation			    AutoRunmode::FileDelegate(3pm)

NAME
CGI::Application::Plugin::AutoRunmode::FileDelegate - delegate CGI::App run modes to a directory of files SYNOPSIS
# in file runmodes/my_run_mode.pl sub { my ($app, $delegate) = @_; # do something here }; # in file runmodes/another_run_mode.pl sub { # do something else }; package MyApp; use base 'CGI::Application'; use CGI::Application::Plugin::AutoRunmode qw [ cgiapp_prerun]; use CGI::Application::Plugin::AutoRunmode::FileDelegate(); sub setup{ my ($self) = @_; my $delegate = new CGI::Application::Plugin::AutoRunmode::FileDelegate ('/path/to/runmodes') $self->param('::Plugin::AutoRunmode::delegate' => $delegate); } # you now have two run modes # "my_run_mode" and "another_run_mode" DESCRIPTION
Using this module, you can place the definition of your run modes for a CGI::Application into directory of files (as opposed to into a Perl module). Each run mode is contained in its own file, named foo.pl for a run mode called foo. The run modes are lazily evaluated (on demand) for each request. In the case of mod_perl this means you can update them without restarting your web server. In the case of plain CGI it means a reduced startup cost if you have many run modes (because only the one that you need gets parsed and loaded, along with dependent modules). Using more than one directory with runmodes You can pass multiple directory paths to the constructor for the delegate: my $delegate = new CGI::Application::Plugin::AutoRunmode::FileDelegate ('/path/to/runmodes', '/path/to/more_runmodes') In this case, they will be searched in order. The first matching file becomes the run mode. In the case of errors with that file, the module will croak (and not continue the search in the remaining directories). BUGS
With all the namespace nesting going on the name of this module has reached an intolerable Java-esque length. SEE ALSO
If you like the idea of moving everything outside of Perl modules into separate files, you should also have a look at CGI::Application::Plugin::TemplateRunner, which does a similar thing for HTML templates and the Perl code needed to provide them with data. AUTHOR
Thilo Planz, <thilo@cpan.org> COPYRIGHT AND LICENSE
Copyright 2005 by Thilo Planz This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.3 2011-06-25 AutoRunmode::FileDelegate(3pm)

Check Out this Related Man Page

CGI
::Application::Plugin::AnyTemplate::ComponentHandler(User Contributed Perl DocumentCGI::Application::Plugin::AnyTemplate::ComponentHandler(3pm) NAME
CGI::Application::Plugin::AnyTemplate::ComponentHandler - Embed run modes within a template DESCRIPTION
This is a little helper module used by CGI::Application::Plugin::AnyTemplate to handle finding and running the run modes for embedded components, and returning their content. You shouldn't need to use this module directly unless you are adding support for a new template system. For information on embedded components see the docs of CGI::Application::Plugin::AnyTemplate. METHODS
new Creates a new "CGI::Application::Plugin::AnyTemplate::ComponentHandler" object. my $component_handler = CGI::Application::Plugin::AnyTemplate::ComponentHandler->new( webapp => $webapp, containing_template => $template, ); The "webapp" parameter should be a reference to a "CGI::Application" object. The "containing_template" parameter should be a reference to the template object in which this component is embedded. embed Runs the specified "runmode" of the "webapp" object. Returns the results of this call. Parameters passed to embed should be passed on to the run mode. If the results are a scalar reference, then the return value is dereferenced before returning. This is the safest way of calling a run mode since you'll get the output as a string and return it as a string, but it involves returning potentially very large strings from subroutines. embed_direct Runs the specified "runmode" of the "webapp" object. Returns the results of this call. Parameters passed to embed_direct should be passed on to the run mode. Even if the result of this call is a scalar reference, the result is NOT dereferenced before returning it. If you call this method instead of embed, you should be careful to deal with the possibility that your results are a reference to a string and not the string itself. AUTHOR
Michael Graham, "<mgraham@cpan.org>" COPYRIGHT &; LICENSE Copyright 2005 Michael Graham, All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2010-12-16 CGI::Application::Plugin::AnyTemplate::ComponentHandler(3pm)
Man Page