1AutoRunmode::FileDelegaUtsee(r3)Contributed Perl DocumenAtuattoiRounnmode::FileDelegate(3)
2
3
4

NAME

6       CGI::Application::Plugin::AutoRunmode::FileDelegate - delegate CGI::App
7       run modes to a directory of files
8

SYNOPSIS

10               # in file runmodes/my_run_mode.pl
11                       sub  {
12                               my ($app, $delegate) = @_;
13                                       # do something here
14                       };
15
16               # in file runmodes/another_run_mode.pl
17                       sub {
18                                       # do something else
19                       };
20
21
22               package MyApp;
23               use base 'CGI::Application';
24               use CGI::Application::Plugin::AutoRunmode
25                       qw [ cgiapp_prerun];
26               use CGI::Application::Plugin::AutoRunmode::FileDelegate();
27
28                       sub setup{
29                               my ($self) = @_;
30                               my $delegate = new CGI::Application::Plugin::AutoRunmode::FileDelegate
31                                               ('/path/to/runmodes')
32                               $self->param('::Plugin::AutoRunmode::delegate' => $delegate);
33                       }
34
35                # you now have two run modes
36                # "my_run_mode" and "another_run_mode"
37

DESCRIPTION

39       Using this module, you can place the definition of your run modes for a
40       CGI::Application into directory of files (as opposed to into a Perl
41       module).
42
43       Each run mode is contained in its own file, named foo.pl for a run mode
44       called foo.  The run modes are lazily evaluated (on demand) for each
45       request.  In the case of mod_perl this means you can update them
46       without restarting your web server. In the case of plain CGI it means a
47       reduced startup cost if you have many run modes (because only the one
48       that you need gets parsed and loaded, along with dependent modules).
49
50   Using more than one directory with runmodes
51       You can pass multiple directory paths to the constructor for the
52       delegate:
53
54               my $delegate = new CGI::Application::Plugin::AutoRunmode::FileDelegate
55                               ('/path/to/runmodes', '/path/to/more_runmodes')
56
57       In this case, they will be searched in order. The first matching file
58       becomes the run mode. In the case of errors with that file, the module
59       will croak (and not continue the search in the remaining directories).
60

BUGS

62       With all the namespace nesting going on the name of this module has
63       reached an intolerable Java-esque length.
64

SEE ALSO

66       If you like the idea of moving everything outside of Perl modules into
67       seperate files, you should also have a look at
68       CGI::Application::Plugin::TemplateRunner, which does a similar thing
69       for HTML templates and the Perl code needed to provide them with data.
70

AUTHOR

72       Thilo Planz, <thilo@cpan.org>
73
75       Copyright 2005 by Thilo Planz
76
77       This library is free software; you can redistribute it and/or modify it
78       under the same terms as Perl itself.
79
80
81
82perl v5.34.0                      2021-07-22      AutoRunmode::FileDelegate(3)
Impressum