NAME
Egg::Helper::O::Test::Prepare - A virtual project for the test is constructed.
SYNOPSIS
use Egg::Helper;
my $test= Egg::Helper->run('O::Test');
my $run_modes= <<END_OF_RUNMODES;
 _default=> sub {},
 foo=> {
   qr/a(\d+)/=> sub { .... },
   { hoge=> 'POST' }=> \\\&MYPROJECT::D::Foo::hoge,
   },
END_OF_RUNMODES
$test->prepare(
  project_name => 'MyProject',
  config=> {
    title=> 'test project.',
    },
  include_path=> [qw( /path/perl-lib /path/lib )],
  controller => {
    egg=> [qw/-Debug PluginName/],
    },
  dispatch=> {
    extend_codes_first=> "use MYPROJECT::D::Foo;\n",
    run_modes=> $run_modes,
    },
  );DESCRIPTION
The virtual project file is generated and this module is constructed.
The main method is 'prepare', and other 'prepare_*' is called according to the option to usually pass to 'prepare'.
METHODS
The methods other than 'prepare' need not be individually called usually.
prepare ([OPTION])
The work directory is temporarily made, the virtual project file is generated there, and the project environment for the test is constructed.
The following files are generated in default.
/tmp/... /EggVirtual/lib/EggVirtual.pm
/tmp/... /EggVirtual/lib/EggVirtual/config.pm
/tmp/... /EggVirtual/lib/EggVirtual/D.pm
/tmp/... /EggVirtual/bin/trigger.cgi
/tmp/... /EggVirtual/bin/eggvirtual_helper.pl
/tmp/... /EggVirtual/Makefile.PL
/tmp/... /EggVirtual/Build.PL
/tmp/... /EggVirtual/htdocs
/tmp/... /EggVirtual/root
/tmp/... /EggVirtual/comp
/tmp/... /EggVirtual/tmp/uploads
/tmp/... /EggVirtual/cacheIt is possible to customize it by passing the option composed of HASH.
List of option.
- project_name - The project name is specified. - Default becomes a name obtained with $test->project_name. 
- include_path - The include passing can be set by the ARRAY reference. - * It uses it to specify the include passing besides the project root. 
- config - The configuration can be set by the HASH reference. - * Necessary minimum configuration is set by default. 
- mason_ok - Mason is used to set VIEW. Default is Template. - If VIEW is set to config, this option doesn't have the meaning. - * However, it stays in both cases in a rudimentary setting. 
- controller - The setting to customize the controller file can be set by the HASH reference. - egg - The module option to pass to Egg is set by the ARRAY reference. Please set the debugging flag and the plugin, etc. - controller=> { egg=> [qw{ -Debug Filter Encode }], },
- version - It is a version of the controller file. Default is '0.01'. 
- extend_codes_first - The script code of the first stage of the controller file is given by the text. I think that it becomes a code for the module to want to read and the module to want to succeed to usually. - my $ctl_code_first= <<END_OF_CODE; use Unicode::Japanise; use base qw/MYPROJECT::BASE/; END_OF_CODE controller=> { extend_codes_first=> $ctl_code_first, },
- extend_codes - The script code in the latter half of the controller file is given by the text. - my $ctl_code= <<END_OF_CODE; sub create_encode { my(\$e)= \@_; Unicode::Japanise->new; } END_OF_CODE controller=> { extend_codes=> $ctl_code, },
 
- dispatch - The setting to customize dispatch can be set by the HASH reference. - run_modes - The setting of __PACKAGE__->run_modes can be set in the text. Please note that it is not HASH. Moreover, please describe the part in parentheses of __PACKAGE__->run_modes( );. - my $run_modes= <<END_OF_RUNMODE; _default=> sub {}, foge=> { { foo=> 'GET' }=> \\\&foo, { boo=> 'POST' }=> \\\&MYPROJECT::D::CUSTOM::boo, }, END_OF_RUNMODE dispatch=> { run_modes=> $run_modes, },
- default_mode - The value given to __PACKAGE__->default_mode can be set. - dispatch=> { default_mode=> '_index', },
- mode_param - The value given to __PACKAGE__->mode_param can be set. - dispatch=> { mode_param=> 'mode', },
- extend_codes_first - The script code of the first stage of dispatch is given by the text. - my $dispat_code_first= <<END_OF_CODE; use MYPROJECT::D::CUSTOM; END_OF_CODE dispatch=> { extend_codes_first=> $dispat_code_first, },
- extend_codes - The script code in the latter half of dispatch is given by the text. - my $dispat_code= <<END_OF_CODE; sub foo { my(\$dispat, \$e)= \@_; \$e->response->body('is foo page.'); } END_OF_CODE
 
- create_files - To make a file besides the file made from default, data is given by the ARRAY reference. Please set each value of ARRAY by the form given to $test->save_file. - After it moves to project_root, the file is made. Therefore, filename can be specified by the relative path. Moreover, $test->conv is substituted. - my $file_value= <<END_OF_VALUE; package <# project_name #>::D::CUSTOM; use strict; sub boo { my(\$dispat, \$e)= \@_; \$e->response->body('is boo.'); } END_OF_VALUE create_files=> [ { filename=> 'lib/<# project_name #>/D/CUSTOM.pm', value=> $file_value, }, ],
prepare_controller
It sets it concerning the controller.
prepare_include_path
The ink route passing is set.
prepare_egg
The module option of Egg is set.
prepare_dispatch
It sets it concerning dispatch.
prepare_config
It sets it concerning the configuration.
SEE ALSO
Egg::Helper::O::Test, Egg::Release,
AUTHOR
Masatoshi Mizuno, <lushe@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2007 Bee Flag, Corp. <http://egg.bomcity.com/>, All Rights Reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.