Egg::Helper - Helper module for Egg WEB Aplication Framework.
# Obtaining of helper script. perl -MEgg::Helper -e 'Egg::Helper->out' > egg_helper.pl # Generation of project. perl egg_helper.pl Project MyApp -o /home # The helper of the project is used. perl MyApp/bin/myapp_helper.pl Plugin::Maker NewPlugin
This offers the helper function to use Egg WEB Aplication Framework.
* This document is the one to make the helper script chiefly. It is not personally related to the composition of WEB Aplication.
It becomes help of the helper script development, and it explains the behavior etc. of this module.
This module starts the helper module specified from the command line according to the following procedures.
perl myapp_helper.pl Plugin::Maker NewPlugin
Myapp_helper.pl is a helper script only for the project generated to the bin folder of the project.
run
The command line is evaluated by this method.
The part of continuing myapp_helper.pl Plugin::Maker is recognized as a helper module of the object that puts the start.
And, it tries to evaluate a suitable name or the option.
The part of NewPlugin is concretely identified to 'any_name' in this example. It comes to be able to refer from the helper module with $helper->global->{any_name}. If the character string that starts by '_' continues, it is treated as an option. It comes to be able to access it globally by the name defined by the method of '_setup_get_options'.
execute
The object helper module is read after the command line is suitably evaluated, and the method of '_execute' is called.
At this time, it adds in @ISA of the object helper module beforehand and it adds it to Egg::Helper. As a result, it comes to be able to call all methods of Egg::Helper from the object helper module like the method completely. Egg::Helper operates in a word consequentially like the framework for the helper module.
A convenient code is only freely written now if a target helper module starts.
Constructor.
It uses it when processing it after the object is made by the method of '_execute'.
The object of the HASH reference base is restored.
It is an accessor to global HASH.
When the method of '_execute' was called, some values had already been defined.
It prepares it. receive the option from the command line.
OPTION_STRING is an option to pass to Getopt::Easy. * ' o-out= g-debug h-help ' is added without fail.
The default of HELP_CODE is $helper->can('_output_help').
$helper->SUPER::_setup_get_options( ' u-user_name= p-password= ' );
Please refer to the document of Getopt::Easy.
After the global variable is set up, the helper module is started.
MODE is a name of the helper who puts the start.
* This name is progressed , saying that 'Egg::Helper::[MODE]'. * MODE that doesn't contain ':' is not accepted.
It is ,in a word, a part of 'Plugin::Maker' of the place said by the DEVELOPER explanation example.
The current directory in the place where the helper script was started is returned.
Route PATH of the project of the object is returned.
* Anything doesn't return when project_root of ARGS_HASH passed with run is erased.
The current directory is changed and it reports to STDOUT.
After TARGET_DIR is made, chdir is done when CREATE_FLAG is given.
After CREATE_PATH is made, it reports to STDOUT.
It moves even if a deep hierarchy is suddenly specified because mkpath of File::Path is used.
After DELETE_PATH is deleted, it reports to STDOUT.
Because rmtree of "File::Path " is used, the subdirectory is recurrently deleted.
It reports to STDOUT if the deletion of DELETE_FILE is tested, and it succeeds.
DELETE_FILE can be passed with ARRAY.
The content is returned reading FILE_PATH.
Alias: fread
It saves a file based on structural the following SAVE_DATA_HASH, and it reports to STDOUT.
filename ... PATH and name of made file. If the directory doesn't exist making ahead, it makes it. value ... Content of made file. filetype ... File type. - If it is a name that starts by bin, it starts doing decode_base64 of L<MIME::Base64>, and it developing with the binary. - If it is a name that starts by script or bin_exec, chmod 0700 is done.
Filename is put on $helper->replace.
Value is put on $helper->replace in case of not being in the name that the file type starts by bin.
$helper->save_file({ filename => 'etc/example.txt', value => $example_value, }, \%param_data ); $helper->save_file({ filename => 'htdocs/images/example.png', filetype => 'bin', value => $base64_encode_text, });
YAML_TEXT or YAML_FILE_PATH is done in Perth and the result is returned.
The setting of the project is read and returned.
When PM_ONLY_FLAG is given, it reads for only config.pm.
The file complete set is generated based on structural the following OPERATION_ATTR_HASH.
chdir => [ [PATH], [FLAG] ]
If chdir is done, it defines it. This is an argument passed to $helper->chdir and an always ARRAY reference.
create_files => [ [SAVE_DATA_HASH] ]
The made file data is defined by the ARRAY reference.
Each value of ARRAY is an argument passed to $helper->save_file.
create_dirs => [ [CREATE_PATH_ARRAY] ]
An empty directory is made.
create_code => [CODE_REF],
The code can be added.
The helper object is passed to the code.
makemaker_ok => [ 1 or 0 ]
After the file complete set is generated, a series of perl Makefile.PL and others make test is done.
complete_msg => [COMPLETE_MESSAGE],
COMPLETE_MESSAGE set when the generation processing is completed is output to STDOUT.
errors => [OPTION_HASH],
It is a setting concerning the settlement when the error occurs.
rmdir => [DELETE_DIR_ARRAY] List of deleted directory. This list extends to $helper-E<gt>remove_dir. unlink => [DELETE_FILE_ARRAY] List of deleted file. This list extends to $helper-E<gt>remove_file. message => [ERROR_MESSAGE] It is an error message.
$helper->generate( chdir => [qw{ /path/to/home 1 }], create_files => \@files, create_dirs => \@dirs, makemaker_ok => 0, complete_msg => ' ... Coumpete. ', create_code => sub { ... }, errors => { rmdir => \@dirs, unlink => \@files, message => ' ... Internal Error !! ', }, );
The number of the test file newly made is returned.
'00' is returned when project_root cannot be acquired or project_root/t has been deleted or it fails in acquisition.
my $test_number= $helper->testfile_number_now;
It checks whether file PATH composition is resolved and the name of each hierarchy is suitable as the module name of Perl.
And, the result of the check is returned with ARRAY.
If it is not suitable among hierarchies even by one place as the module name of Perl, 0 is returned.
$helper->mod_name_resolv('./MyApp/Orign/tools');
OS while operating it is returned.
'Unix' returns if there is neither 'Win32' nor 'MacOS'.
One returns if judged that $helper->is_platform is 'Unix'.
One returns if judged that $helper->is_platform is 'Win32'.
One returns if judged that $helper->is_platform is 'MacOS'.
When PROJECT_NAME is given, the project name is set again.
However, if it is not suitable as ':' is contained as the project name, the exception is generated.
When PROJECT_NAME is omitted, the project name under the setting is returned.
* Because the helper module is loaded with the project name has been set, it is not necessary to set it again usually.
The current directory is returned.
A present Christian era is returned.
DIR_PATH exists, and it is recordable is checked.
When the check cannot be passed, the exception is generated.
Passing the main body of perl is returned.
The value is returned if environment variable 'PERL_PATH' is set, and PATH is specified by File::Which in case of not being. When everything fails, the exception is generated.
Reading the rc file is tried by Egg::Plugin::rc. And, 'copywright' etc. are set up to $helper->global.
Please refer to RESOURCE CODE VARIABLE for details.
-h It moves when help is demanded by the option etc.
Override may do this method on the helper module side.
The helper script code is output.
Please preserve the output code in a suitable place and use it.
perl -MEgg::Helper -e "Egg::Helper->out" > /path/to/bin/egg_helper.pl
It is a key to global HASH that will be set up by the time the helper module is called list.
Project name.
Route PATH of project.
When the name has been passed to the helper script, it is set.
-d When $ENV{EGG_DEBUG} is set, whether the option is effective it is set.
* If this value is effective, it sets it up like displaying the stack trace when the error occurs.
The current directory is set.
-o If the option is effective, it is set. Or, if $ENV{EGG_OUT_PATH} is set, this value is set. If it is undefined, all current directories are set above.
-h If the option is effective, it is set.
Additionally, the global value set beforehand changes by the option to pass to the setting and the run method of the method of '_setup_get_options'.
When the method of '_setup_rc' is called, loading the rc file is tried by way of Egg::Plugin::rc. And, HASH that succeeds in loading is set in a global value.
It is a key as follows set up without fail when the method of '_setup_rc' is called.
author, copyright, headcopy
* The above-mentioned default is a value obtained with $ENV{LOGNAME} or $ENV{USER}. * It is escaped in the mail address and <> for pod.
When the module file is generated, a special global value is set up when '_setup_module_maker' is called beforehand.
This is a list of the key set up.
Name and version mark of helper script under operation.
Character for CVS and SVN to substitute it as Ribijon.
* It is measures against the situation that the character for the Ribijon mark replaces by committing of the helper script.
lib/$e->project_name
Entire project name of small letter.
Entire project name of capital letter.
The first character is a project name of the capital letter.
0.01
Version of Perl under operation.
Version of Egg::Release.
Value of gmtime.
Christian era when starting. (CODE reference)
Pod document of default. (CODE reference)
The module name is decided from the file name of the generation module. (CODE reference)
File::Path, File::Which, Getopt::Easy, MIME::Base64, YAML, Egg::Base, Egg::Exception, Egg::Plugin::rc, Egg::Release,
Masatoshi Mizuno <lushe@cpan.org>
Copyright (C) 2007 by 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.
1 POD Error
The following errors were encountered while parsing the POD:
L<> starts or ends with whitespace
To install Egg::Release, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Egg::Release
CPAN shell
perl -MCPAN -e shell install Egg::Release
For more information on module installation, please visit the detailed CPAN module installation guide.