File Coverage

lib/Egg.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 20 20 100.0


line stmt bran cond sub pod time code
1             package Egg;
2             #
3             # Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt>
4             #
5             # $Id: Egg.pm 337 2008-05-14 12:30:09Z lushe $
6             #
7 37     37   2086 use strict;
  37         1526  
  37         13407  
8 37     37   9432 use warnings;
  37         2983  
  37         1111  
9 37     37   495 use Egg::Exception;
  37         70  
  37         327  
10 37     37   968 use Carp qw/ croak /;
  37         64  
  37         2679  
11 37         22095 use base qw/
12             Egg::Util
13             Egg::Component
14 37     37   199 /;
  37         62  
15             use Egg::Manager::View;
16             use Egg::Manager::Model;
17             use Egg::Request;
18             use Egg::Response;
19              
20             *egg_startup= \&_startup;
21              
22             our $VERSION= '3.04';
23              
24             sub import {
25             shift;
26             my $p= $ENV{EGG_IMPORT_PROJECT} || caller(0) || return 0;
27             $p=~s{\:+trigger$} [];
28             return if ($p eq 'main' or $p eq __PACKAGE__);
29             local $SIG{__DIE__}= sub { Egg::Error->throw(@_) };
30             my (%flags, @plugins);
31             for (@_) {
32             if (/^(\-.+)/) {
33             $flags{lc($1)}= 1;
34             } else {
35             my $load= /^=(.+)/ ? do { $_= $1; 0 }: 1;
36             my $p_class= /^\+([A-Z].+)/ ? $1: "Egg::Plugin::$_";
37             push @plugins, [$load, $p_class];
38             }
39             }
40             no strict 'refs'; ## no critic
41             my $isa= \@{"${p}::ISA"};
42             push @{"${p}::ISA"}, $_ for qw/
43             Egg::Manager::View
44             Egg::Manager::Model
45             Egg::Request
46             Egg::Response
47             Egg
48             /;
49             $p->initialize;
50             $p->init_model;
51             $p->init_view;
52             for (qw/ global _dispatch_map uc_namespace lc_namespace is_exception /)
53             { $p->mk_classdata($_) unless $p->can($_) }
54             my $name_uc= $p->uc_namespace(uc $p);
55             $p->lc_namespace(lc $p);
56             my $g= $p->global({ flag=> \%flags });
57             no warnings 'redefine';
58             *{"${p}::project_name"}= $p->can('namespace');
59             $p->isa_register(@$_) for @plugins;
60             my $name= "${name_uc}_DISPATCH_CLASS";
61             my $d_class;
62             if (defined($ENV{$name})) {
63             if ($d_class= $ENV{$name}) { $p->isa_register(2, $d_class) }
64             } else {
65             $d_class= "${p}::Dispatch";
66             $p->isa_register(0, $d_class);
67             $d_class->use or die "$p - $@";
68             }
69             $g->{dispatch_class}= $d_class || "";
70             $p->mk_classdata('dispatch_map') unless $p->can('dispatch_map');
71             $p->isa_terminator(__PACKAGE__);
72             $p->_import;
73             }
74             sub _startup {
75             local $SIG{__DIE__}= sub { Egg::Error->throw(@_) };
76             my $class= shift;
77             my $c= $class->config($class->_load_config(@_));
78             my $e= $class->_egg_context( egg_startup=> 1 );
79             $e->_setup_comp;
80             $e->setup_model;
81             $e->setup_view;
82             my $report= $e->_setup_methods;
83             no strict 'refs'; ## no critic
84             no warnings 'redefine';
85             # Create Stash Accessor.
86             my $accessors= $c->{accessor_names} || [];
87             for my $accessor ('template', @$accessors) {
88             *{__PACKAGE__."::$accessor"}= sub {
89             my $egg= shift;
90             return $egg->stash->{$accessor} || "" unless @_;
91             $egg->stash->{$accessor}= shift || "";
92             };
93             }
94             $e->_setup($c);
95             $report->($e);
96             $class;
97             }
98             sub new {
99             my $class= shift;
100             my $r= shift || undef;
101             my $e= $class->_egg_context;
102             $e->start_bench;
103             $e->model_manager->reset($e);
104             $e->view_manager->reset($e);
105             $e->request($r);
106             $e;
107             }
108             sub run {
109             my $e= shift->new(@_);
110             eval { $e->_start_engine };
111             if ($@) {
112             $e->is_exception(1);
113             $e->error($@);
114             $e->_finalize_error;
115             }
116             $e->_result;
117             }
118             sub finished {
119             my $e= shift;
120             return $e->{finished} unless @_;
121             if (my $status= shift) {
122             $status= $e->response->status($status)
123             || croak q{ It tried to set illegal status. };
124             $e->log->error(@_) if (@_ and $status== 500);
125             return $e->{finished}= 1;
126             } else {
127             $e->response->status(0);
128             return $e->{finished}= 0;
129             }
130             }
131             sub dispatch {
132             croak q{ I want 'dispatch' method to be setup. };
133             }
134             sub _egg_context {
135             my $class= shift;
136             bless {
137             namespace => $class->namespace,
138             stash => {},
139             snip => [],
140             action => [],
141             finished => 0,
142             @_,
143             }, $class;
144             }
145             sub _start_engine_main {
146             my($e)= @_;
147             $e->_prepare;
148             $e->_dispatch;
149             $e->_action_start;
150             $e->_action_end;
151             $e->_finalize;
152             $e->_output;
153             $e->_finish;
154             $e;
155             }
156             sub _dispatch {
157             my($e)= @_;
158             $e->{finished} || $e->dispatch->_start;
159             $e;
160             }
161             sub _action_start {
162             my($e)= @_;
163             return $e if ($e->{finished} or $e->response->body);
164             $e->dispatch->_action;
165             $e->view->output if (! $e->{finished} and ! $e->response->body);
166             $e;
167             }
168             sub _action_end {
169             my($e)= @_;
170             return $e unless $e->{finished};
171             $e->dispatch->_finish;
172             $e;
173             }
174             sub _finalize_error {
175             my($e)= @_;
176             my $status= $e->response->status || 500;
177             my $error = $e->errstr || 'Internal Error.';
178             $e->debug_end("${status}: ${error}");
179             $e->debug_screen;
180             $e;
181             }
182             sub _output {
183             my($e)= @_;
184             my $body = $e->response->body || \"";
185             my $header= $e->response->header($body);
186             $e->request->output($header, $body);
187             }
188             sub _result {
189             $_[0]->request->result;
190             }
191             sub _setup_methods {
192             my $e= shift;
193             my $p= shift || $e->namespace;
194             my($bench, $report);
195             if ($e->debug) {
196             require Egg::Util::Debug;
197             $bench= Egg::Util::Debug->_setup($e, $p);
198             $report= \&Egg::Util::Debug::_report;
199             } else {
200             $bench= $e->_setup_method_main($p);
201             $report= sub {};
202             }
203             no strict 'refs'; ## no critic.
204             no warnings 'redefine';
205             *{"${p}::start_bench"}= sub { $bench->(@_) };
206             $report;
207             }
208             sub _setup_method_main {
209             my($e, $p)= @_;
210             $e->_setup_log($p);
211             no strict 'refs'; ## no critic
212             no warnings 'redefine';
213             *{"${p}::_start_engine"}= \&_start_engine_main;
214             *{"${p}::debug_screen"}= $e->config->{allow_debug_screen} ? do {
215             $SIG{__DIE__}= sub { Egg::Error->throw(@_) };
216             my $dbgscreen=
217             $ENV{"${p}_DEBUG_SCREEN_CLASS"} || 'Egg::Util::DebugScreen';
218             $dbgscreen->require or die $@;
219             $dbgscreen->can('_debug_screen');
220             }: sub {};
221             *{"${p}::debug_out"}= sub {};
222             *{"${p}::debug_end"}= sub {};
223             *{"${p}::egg_warn"} = sub {
224             my @c= caller();
225             warn qq{ I want you to delete warning of $c[0] line $c[2]. };
226             };
227             *{"${p}::bench"}= sub {};
228             }
229             sub _setup_log {
230             my($e, $p)= @_;
231             my $l_class= $ENV{uc($p). '_LOG_CLASS'} || 'Egg::Log::STDERR';
232             $l_class->require or die $@;
233             my $log= $l_class->new($e);
234             no strict 'refs'; ## no critic
235             no warnings 'redefine';
236             *{"${p}::log"}= sub { $log };
237             }
238              
239             1;
240              
241             __END__
242              
243             =head1 NAME
244              
245             Egg - MVC Framework.
246              
247             =head1 DESCRIPTION
248              
249             Egg is WEB application framework with the control facilit of Model/View/Controller.
250              
251             The specification changed with v2.x system and a former version.
252             Therefore, interchangeability is not secured.
253              
254             =head1 HELPER
255              
256             The helper script is first generated to use Egg, and the project file complete
257             set is generated with the script.
258              
259             And, the application is constructed with the change of the setting of the project
260             and the addition of the module.
261              
262             =head2 Generation of helper script.
263              
264             % perl -MEgg::Helper -e 'Egg::Helper->helper_script' > egg_helper.pl
265              
266             When Egg::Helper is as mentioned above started, the helper script is generated
267             to the current directory.
268              
269             It is convenient for the generated script to copy onto the place that manages
270             easily and to set the execution attribute.
271              
272             % cp ./egg_helper.pl /usr/bin
273             % chmod 755 /usr/bin/egg_helper.pl
274              
275             =head2 Making of project.
276              
277             % egg_helper.pl project MyApp
278              
279             It becomes a project name that the part of MyApp newly generates.
280              
281             However, please do not include ':' in the name by the form that is sure to be
282             permitted as a module name of perl.
283              
284             Please specify passing putting '-o' option when you want to specify the output
285             destination.
286              
287             % egg_helper.pl project MyApp -o/path/to
288              
289             It generates it to the current directory at the unspecification.
290              
291             Moreover, when the same directory as the project name already exists at the output
292             destination, generation is discontinued.
293              
294             =head2 Confirmation such as generation files.
295              
296             I think the project to have been made in the directory of/path/to/MyApp in this
297             example. Please confirm the generation file.
298              
299             % cd /path/to/MyApp
300             % ls -la
301             drwxr-xr-x *** .
302             drwxr-xr-x *** ..
303             drwxr-xr-x *** bin
304             -rw-r--r-- *** Build.PL
305             drwxr-xr-x *** cache
306             -rw-r--r-- *** Changes
307             drwxr-xr-x *** comp
308             drwxr-xr-x *** etc
309             drwxr-xr-x *** htdocs
310             drwxr-xr-x *** lib
311             -rw-r--r-- *** Makefile.PL
312             -rw-r--r-- *** MANIFEST
313             -rw-r--r-- *** MANIFEST.SKIP
314             -rw-r--r-- *** README
315             drwxr-xr-x *** root
316             drwxr-xr-x *** t
317             drwxr-xr-x *** tmp
318              
319             It deletes if it is unnecessary and it doesn't care though Build.PL, Changes,
320             Makefile.PL, MANIFEST, MANIFEST.SKIP, README, and t are files among these needed
321             when the project file complete set is assumed to be perl module and the packaging
322             is done.
323              
324             =over 4
325              
326             =item * bin
327              
328             There is a script that seems to be necessary to treat the project it.
329              
330             =item * cache
331              
332             For accumulation of cash data. The authority is set when using it.
333              
334             =item * comp
335              
336             It is a directory that assumes the common part of the template is arranged.
337              
338             =item * etc
339              
340             It is a configuration file and others, and a place to use it multipurpose.
341              
342             =item * htdocs
343              
344             It is a place where static contents are set up. It is good to make here
345             'DocumentRoot' of the WEB server.
346              
347             =item * lib
348              
349             It becomes a library passing for the project project that includes the controller,
350             the configuration, and the dispatch, etc. of the project beforehand.
351              
352             =item * root
353              
354             It is a place to arrange the template. There is index.tt of the sample.
355              
356             =item * tmp
357              
358             Please use it temporarily as a place where the work file is put.
359              
360             =back
361              
362             =head2 Confirming the operation of project.
363              
364             Please confirm whether to operate normally first of all in the state of default
365             when the project is generable.
366              
367             % cd bin
368             % ./trigger.cgi
369              
370             'trigger.cgi' is a script when operating as usual CGI.
371              
372             I think that default operates normally if this script outputs the HTML source.
373              
374             Egg demonstrates the highest performance of origins such as mod_perl and FastCGI.
375             A practicable performance is not obtained by usual CGI.
376              
377             Please use 'trigger.cgi' when using it from Apache::Registry and Apache::PerlRun.
378              
379             'dispatch.fcgi' is used when using it with FastCGI.
380              
381             Moreover, it is necessary to set 'mod_rewrite'.
382             It explains in detail at the following.
383              
384             =head2 Construction of application.
385              
386             The method of constructing the application makes it omit in this document.
387             It takes up and it explains an easy example in L<Egg::Release>.
388              
389             It explains the role etc. of the system configuration and 'Egg.pm' of Egg in
390             this document.
391              
392             =head1 SYSTEM
393              
394             The main of the system of Egg is a project module.
395             The file is /path/to/MyApp/lib/MyApp.pm.
396              
397             In a word, it becomes a controller to whom this file sets loading the configuration
398             and the plugin etc.
399              
400             Egg is started from this controller.
401             And, the configuration is taken by initial operation.
402             Afterwards, it registers in @ISA of the project after the plug-in is loaded one
403             by one, and it registers in end @ISA.
404              
405             As a result, it comes to be able to call the method of all modules by way of the
406             object of the project at what time.
407             Moreover, the plug-in module can add original processing picking up the hook that
408             Egg calls at what time.
409              
410             The model and the view are registered with this @ISA Cdacdacata.
411             And, those modules are treated with more peculiar @ISA Cdacdacata to the handler
412             object of the model and the view though the model and the view can treat two or
413             more modules at the same time.
414              
415             It is a system that treats the object that masses by the @ISA base like this and
416             outputs contents.
417              
418             =head1 METHOD CALL
419              
420             Egg does the following calls and outputs contents.
421              
422             =over 4
423              
424             =item * _setup
425              
426             It is a call only when starting being called from 'import' of Egg.
427              
428             =item * _prepare
429              
430             It is a call for the preparation starting processing. Any Egg is not done.
431              
432             =item * _dispatch
433              
434             If $e-E<gt>finished has defined it, nothing has already been done though whether
435             $e-E<gt>dispatch-E<gt>_start is done and what action you do are decided.
436              
437             =item * _action_start
438              
439             If $e-E<gt>finished or $e-E<gt>response-E<gt>body has defined it, nothing has
440             already been done though $e-E<gt>dispatch-E<gt>_action is done and the decided
441             action is processed.
442              
443             =item * _action_end
444              
445             If $e-E<gt>finished has defined it, nothing has already been done though the
446             processing of dispatch is completed by $e-E<gt>dispatch-E<gt>_finish.
447              
448             =item * _finalize
449              
450             It is a call for the processing end. Any Egg is not done.
451              
452             =item * _output
453              
454             Contents are output.
455              
456             =item * _finish
457              
458             It is a call to complete all processing. Any Egg is not done.
459              
460             =item * _finalize_error
461              
462             When some errors occur, 'finish' is called. The content of the error can be
463             acquired in 'errstr' method.
464              
465             =item * _result
466              
467             It is a call to return the return value of run. Even whenever the exception is generated, it
468             is called. Please confirm whether $e-E<gt>is_exception is confirmed and the exception was
469             generated when you process the hook by this.
470              
471             =back
472              
473             * Egg doesn't define $e-E<gt>finished.
474             Please note that $e-E<gt>finished always returns undefined as long as not defined on the
475             application side etc.
476              
477             =head1 METHODS
478              
479             This module is L<Egg::Util>, L<Egg::Component>, L<Egg::Base>. It succeeds to.
480              
481             =head2 new
482              
483             Constructor. This is usually called from the 'handler' method.
484              
485             use MyApp;
486             my $e= MyApp->new;
487              
488             =head2 handler
489              
490             It is a handler for processing to the WEB request to begin.
491              
492             Egg is generated an appropriate handler by the composition at that time and
493             stands by.
494              
495             This method succeeds processing to the 'run' method.
496             A series of processing concerning the request is done by this.
497              
498             use MyApp;
499             MyApp->handler;
500              
501             =head2 run
502              
503             This method is usually called from the handler method and does a series of
504             processing to the request.
505              
506             =head2 egg_startup ([CONFIGURATION])
507              
508             To start the project, it sets it up.
509              
510              
511             =head2 finished ([HTTP_RESPONSE_STATYS])
512              
513             When processing is ended, it sets it.
514              
515             When finished returns true, Egg cancels some processing.
516              
517             The argument is sent to $e-E<gt>response->status as it is.
518             In a word, the HTTP response status is given when setting it.
519             see L<Egg::Response>.
520              
521             '0' However, when Azca is gotten, it is initialized with $e-E<gt>response-E<gt>status.
522              
523             # Forbidden is returned and it ends.
524             $e->finished(403);
525            
526             # finished A is canceled.
527             $e->finished(0);
528              
529             Please note that Egg doesn't set 'finished'.
530              
531             =head2 dispatch
532              
533             If 'dispatch' is called when the 'dispatch' method is not built into the project,
534             the exception is generated.
535              
536              
537             see L<Egg::Dispatch::Standard>, L<Egg::Dispatch::Fast>
538              
539             =head2 project_name
540              
541             The project name returns.
542              
543             This method is an alias to the method of 'namespace' of L<Egg::Component>.
544              
545             =head2 is_exception
546              
547             When the exception is generated, true is restored.
548              
549             =head2 request
550              
551             The object of L<Egg::Request> is returned.
552              
553             my $req= $e->request;
554              
555             Alias: req
556              
557             see L<Egg::Request>,
558              
559             =head2 response
560              
561             The object of L<Egg::Response> is returned.
562              
563             my $res= $e->response;
564              
565             Alias: res
566              
567             see L<Egg::Response>
568              
569             =head2 model_manager
570              
571             L<Egg::Manager::Model> is returned.
572              
573             =head2 view_manager
574              
575             L<Egg::Manager::View> is returned.
576              
577             =head2 debug_out ([MESSAGE_STRING])
578              
579             The debugging message is output while operating by debug mode.
580             It is $e-E<gt>log-E<gt>notes to actually output.
581              
582             It is replaced with the method of not doing anything when debug mode is invalid.
583              
584             =head2 bench ([LABEL_STRING])
585              
586             It is a method for the bench mark.
587              
588             It is replaced with the method of not doing anything when debug mode is invalid.
589              
590             see L<Egg::Util::BenchMark>.
591              
592             =head1 PLUGIN
593              
594             The module name when the plugin of Egg is loaded only has to specify only the part
595             of Egg::Plugin::PLUGIN_NAME in PLUGIN_NAME.
596              
597             # This specified Egg::Plugin::PluginAny.
598             use Egg qw/ PluginAny /;
599              
600             It specifies it by the full name putting '+' on the head to load an original plugin.
601              
602             use Egg qw/
603             .......
604             +Hoge::Plugin
605             /;
606              
607             =head2 About the method of making the plugin.
608              
609             'use strict' is applied applying the package name to the plugin without fail.
610              
611             package Egg::Plugin::Any;
612             use strict;
613              
614             Moreover, without forgetting $VERSION
615              
616             our $VERSION = '0.01';
617              
618             This $VERSION must be referred to when you the plugin load debug mode.
619              
620             Please add the code as liked now.
621              
622             sub mymethod {
623             my($e)= @_;
624             .....
625             ..... The code of the plug-in is written here.
626             .....
627             $e;
628             }
629              
630             It comes to be able to call it with $e-E<gt>mymethod when making it to such
631             feeling.
632              
633             However, it is already a thing that the method of the definition is not
634             overwrited that wants you to note it.
635              
636             If the plugin that puts interrupt on the call of the method of Egg is made,
637             it is necessary to have it by using $e-E<gt>next::method over the following.
638              
639             sub _prepare {
640             my($e)= @_;
641             .....
642             ..... The code of the plug-in is written here.
643             .....
644             $e->next::method;
645             }
646              
647             The order of interrupt is done in order that the plugin is loaded.
648             The plugin to want to interrupt at the end makes it loaded as much as possible at
649             the end as much as possible.
650              
651             If it wants to process the plugin produced with oneself from which plugin at the end,
652             the thing written as follows can be done.
653              
654             sub _prepare {
655             my($e)= shift->next::method;
656             .....
657             ..... The code of the plugin is written here.
658             .....
659             $e;
660             }
661              
662             However, I think that there is a thing that comes for the user not to use it easily
663             thus.
664              
665             Processing in which the default value etc. beforehand are defined putting interrupt
666             on '_setup' is recommended.
667             Every time, you can not check the configuration when putting it thus.
668              
669             sub _setup {
670             my($e)= @_;
671             my $c= $e->config->{plugin_any} ||= {};
672             $c->{hoge} ||= 'default1';
673             $c->{foo} ||= 'default2';
674             $e->next::method;
675             }
676              
677             Interrupt can be put on the call of all the methods of Egg by such feeling.
678              
679             =head2 Plugin list of standard appending.
680              
681             =over 4
682              
683             =item * L<Egg::Plugin::Charset>
684              
685             It converts into the set character-code and contents are output.
686              
687             =item * L<Egg::Plugin::ConfigLoader>
688              
689             The configuration of another define the file is read.
690              
691             =item * L<Egg::Plugin::Banner::Rotate>
692              
693             Rotation display of banner.
694              
695             =item * L<Egg::Plugin::Debug::Bar>
696              
697             The bar for debugging is buried under the output contents.
698              
699             =item * L<Egg::Plugin::Encode>
700              
701             The and others of the method of converting the character-code is offered.
702              
703             =item * L<Egg::Plugin::File::Rotate>
704              
705             Rotation management in saved file.
706              
707             =item * L<Egg::Plugin::FillInForm>
708              
709             L<HTML::FillInForm> can be treated.
710              
711             =item * L<Egg::Plugin::Filter>
712              
713             The filter of input data is processed.
714              
715             =item * L<Egg::Plugin::FormValidator::Simple>
716              
717             L<FormValidator::Simple> can be treated.
718              
719             =item * L<Egg::Plugin::HTTP::BrowserDetect>
720              
721             The browser judgment that client uses.
722              
723             =item * L<Egg::Plugin::HTTP::HeadParser>
724              
725             Analysis of HTTP header.
726              
727             =item * L<Egg::Plugin::Mason>
728              
729             Plugin for L<HTML::Mason>.
730              
731             =item * L<Egg::Plugin::Prototype>
732              
733             L<HTML::Prototype> can be treated.
734              
735             =item * L<Egg::Plugin::rc>
736              
737             The run control file is read.
738              
739             =item * L<Egg::Plugin::Response::Error>
740              
741             The error document is output.
742              
743             =item * L<Egg::Plugin::Response::Redirect>
744              
745             The screen for redirect is output.
746              
747             =item * L<Egg::Plugin::Tools>
748              
749             Method collection for various processing.
750              
751             =item * L<Egg::Plugin::Upload>
752              
753             The file upload function is offered.
754              
755             =item * L<Egg::Plugin::WYSIWYG::FCKeditor>
756              
757             Plugin to use FCKeditor.
758              
759             =item * L<Egg::Plugin::YAML>
760              
761             YAML can be treated.
762              
763             =back
764              
765             =head2 Recommendation module not included in standard.
766              
767             =over 4
768              
769             =item * L<Egg::Plugin::Cache>
770              
771             Various cache is availably done.
772              
773             =item * L<Egg::Plugin::Crypt::CBC>
774              
775             L<Crypt::CBC> is made available.
776              
777             =item * L<Egg::Plugin::EasyDBI>
778              
779             DBI can be easily treated. see L<Egg::Release::Model::DBI>.
780              
781             =item * L<Egg::Plugin::LWP>
782              
783             LWP is made available.
784              
785             =item * L<Egg::Plugin::MailSend>
786              
787             The Mail Sending function is offered.
788              
789             =item * L<Egg::Plugin::SessionKit>
790              
791             The session function is offered.
792              
793             =item * L<Egg::Release::JSON>
794              
795             It comes to be able to treat JSON easily.
796              
797             =item * L<Egg::Release::XML::FeedPP>
798              
799             L<XML::FeedPP> can be treated.
800              
801             =back
802              
803             =head1 WEB SERVER
804              
805             It is necessary to move it under mod_perl and the FastCGI environment to obtain
806             the best response speed in Egg.
807              
808             To our regret, a practicable response speed is not obtained by usual CGI.
809              
810             =head2 Apache::Registry or Apache::PerlRun
811              
812             'trigger.cgi' that exists in the 'bin' directory of the project is moved to a
813             suitable place and the execution attribute is given. And, mod_rewite is set by
814             the following feeling.
815              
816             RewriteEngine On
817             # RewriteLogLevel 5
818             # RewriteLog /var/log/httpd/rewrite.log
819             RewriteRule ^/trigger\.cgi / [R,L]
820             RewriteRule ^/([^\.]+)?([\?\#].*)?$ /trigger.cgi/$1$2 [L]
821              
822             It is assumed to arrange 'trigger.cgi' in the document route.
823             URI that doesn't contain the dot in this regular expression is treated as
824             dynamic contents.
825             When the dot is contained, everything is not matched to the pattern as static
826             contents.
827             Please change this regular expression when you want to change the evaluation.
828              
829             The setting of Apache::Registry and Apache::PerlRun is omitted.
830              
831             =head2 Apache Handler
832              
833             The setting by the Apache handler has a set sample in the etc directory and refer
834             to that, please.
835              
836             % less etc/mod_perl2.conf.example
837              
838             The sample is for 'mod_perl2'.
839              
840             =head2 FastCGI
841              
842             A set sample is in the etc directory and refer, please.
843             The sample targeted lighttpd.
844              
845             % less etc/lighttpd+fastcgi.conf.example
846              
847             Please arrange 'dispatch.fcgi' that exists in the bin directory in a suitable place.
848             It is a setting that assumes the document route in the sample.
849              
850             And, the execution attribute is given.
851              
852             Please add the setting of the sample to the setting of lighttpd when the above-
853             mentioned work ends.
854              
855             =head2 PersistentPerl (SpeedyCGI)
856              
857             'speedy.cgi' of the 'bin' directory is moved to a suitable place and the execution
858             attribute is given. And, 'mod_rewrite' like Apache::Registry is set.
859             Please do not forget to set for CGI to operate by the WEB server.
860              
861             =head1 DEBUG
862              
863             It operates by debug mode in setting the Debug flag when Egg is loaded.
864              
865             use Egg qw/
866             -Debug
867             /;
868              
869             Moreover, it is possible to use it even by other usages because it is treated as
870             a flag when '-' is applied to the head regardless of the flag for debugging.
871              
872             When the flag is invalidated, it is not necessary to delete it.
873             If another '-' is added, the flag becomes undefined.
874              
875             use Egg qw/
876             --Debug
877             /;
878              
879             =head2 Improvement of development efficiency.
880              
881             If the change in the module basically loaded doesn't reactivate the WEB server,
882             Egg is not reflected.
883              
884             Moreover, the WEB server for development is not included. Therefore, it will do
885             to the development of the application by the thing moved on WEB servers such as
886             'Apache' or 'lighttpd'.
887              
888             However, if Egg doesn't reactivate the WEB server at the change in the module,
889             the change is not reflected.
890             With this, because the development efficiency is very bad, I think that the
891             following devices are indispensable.
892              
893             When PersistentPerl is used, the introduction of L<Module::Refresh> is very
894             effective. 'speedy.cgi' is changed as follows when using it.
895              
896             #!/usr/bin/perperl
897             use Module::Refresh;
898             use MyApp;
899             Module::Refresh->refresh();
900             MyApp->handler;
901              
902             The change in the module comes to be reflected by this immediately.
903              
904             However, neither the dynamic function definition that 'Import' and '_setup'
905             method do nor the change of a set value are reflected.
906             It seem not to be about the one related to these symbol tables though it does
907             very. Please do 'speedy.cgi' in touch in such a case.
908              
909             % touch /path/to/MyApp/htdocs/speedy.cgi
910              
911             L<Module::Refresh> seems not to work well in FastCGI.
912             Please try L<Egg::Plugin::Debug::Bar> when you use FastCGI.
913              
914             =head1 SEE ALSO
915              
916             L<Egg::Release>,
917             L<Egg::Request>,
918             L<Egg::Response>,
919             L<Egg::Manager::Model>,
920             L<Egg::Manager::View>,
921             L<Egg::Component>,
922             L<Egg::Util>,
923             L<Egg::Util::Debug>,
924             L<Egg::Util::DebugScreen>,
925             L<Egg::Log::STDERR>,
926             L<Egg::Exception>
927              
928             =head1 AUTHOR
929              
930             Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt>
931              
932             =head1 COPYRIGHT AND LICENSE
933              
934             Copyright (C) 2008 Bee Flag, Corp. E<lt>L<http://egg.bomcity.com/>E<gt>.
935              
936             This library is free software; you can redistribute it and/or modify
937             it under the same terms as Perl itself, either Perl version 5.8.6 or,
938             at your option, any later version of Perl 5 you may have available.
939              
940             =cut
941