| 1 | package Egg::Helper::Model::FsaveDate; | ||||||||||||
| 2 | # | ||||||||||||
| 3 | # Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt> | ||||||||||||
| 4 | # | ||||||||||||
| 5 | # $Id: FsaveDate.pm 283 2008-02-27 05:27:43Z lushe $ | ||||||||||||
| 6 | # | ||||||||||||
| 7 | 2 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | 2 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | |||||||||||||
| 10 | 2 | our $VERSION= '0.01'; | |||||||||||
| 11 | |||||||||||||
| 12 | 1 | ▶ | sub _start_helper { | ||||||||||
|
Subroutine
_start_helper: called CC=4 SCAR=14.1
| |||||||||||||
| 13 | 1 | my($self)= @_; | |||||||||||
| 14 | 1 | my $c= $self->config; | |||||||||||
| 15 | 1 | ▶ | $c->{helper_option}{project_root} || return $self->_helper_help | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 16 | ('I want you to start from helper of the project.'); | ||||||||||||
| 17 | 1 | my $o= $self->_helper_get_options; | |||||||||||
| 18 | 1 | ▶ | my $version= $self->helper_valid_version_number($o->{version}) || return 0; | ||||||||||
|
Condition50%1/2
$self->helper_valid_version_number($o->{'version'}) || (return 0)
MC/DC0%0/1
$self->helper_valid_version_number($o->{'version'}) || (return 0)
$self->helper_valid_version_number($o->{'version'})
Truth table50%1/2
A
A= $self->helper_valid_version_number($o->{'version'})
| |||||||||||||
| 19 | 1 | my $param= $self->helper_prepare_param({ | |||||||||||
| 20 | module_version=> $version, | ||||||||||||
| 21 | created=> __PACKAGE__. " v$VERSION", | ||||||||||||
| 22 | }); | ||||||||||||
| 23 | 1 | $self->helper_prepare_param_module | |||||||||||
| 24 | ($param, $self->project_name, qw/ Model FsaveDate /); | ||||||||||||
| 25 | my $comp_path= $param->{module_output_filepath}= | ||||||||||||
| 26 | 1 | "$param->{output_path}/lib/$param->{module_filepath}"; | |||||||||||
| 27 | 1 | ▶ | -e $comp_path | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 28 | and return $self->_helper_help("'$comp_path' already exists."); | ||||||||||||
| 29 | $self->helper_generate_files( | ||||||||||||
| 30 | param => $param, | ||||||||||||
| 31 | 1 | chdir => [$param->{output_path}], | |||||||||||
| 32 | create_files => [$self->helper_yaml_load(join '', <DATA>)], | ||||||||||||
| 33 | errors => { unlink=> [$comp_path] }, | ||||||||||||
| 34 | complete_msg => "\nFsaveDate controller generate is completed.\n\n" | ||||||||||||
| 35 | . "output path : $comp_path\n\n" | ||||||||||||
| 36 | ); | ||||||||||||
| 37 | 1 | $self; | |||||||||||
| 38 | } | ||||||||||||
| 39 | 0 | ▶ | sub _helper_help { | ||||||||||
|
Subroutine
_helper_help: not called CC=3 SCAR=24.8
| |||||||||||||
| 40 | 0 | my $self = shift; | |||||||||||
| 41 | 0 | ▶ | my $msg = shift || ""; | ||||||||||
|
Condition0%0/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||
| 42 | 0 | my $pname= lc $self->project_name; | |||||||||||
| 43 | 0 | ▶ | $msg= "ERROR: ${msg}\n\n" if $msg; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 44 | 0 | print <<END_HELP; | |||||||||||
| 45 | ${msg}% perl ${pname}_helper.pl M::FsaveDate | ||||||||||||
| 46 | |||||||||||||
| 47 | END_HELP | ||||||||||||
| 48 | 0 | 0; | |||||||||||
| 49 | } | ||||||||||||
| 50 | |||||||||||||
| 51 | 2 | 1; | |||||||||||
| 52 | |||||||||||||
| 53 | =head1 NAME | ||||||||||||
| 54 | |||||||||||||
| 55 | Egg::Helper::Model::DBI - Helper who generates controller for model 'FsaveDate'. | ||||||||||||
| 56 | |||||||||||||
| 57 | =head1 SYNOPSIS | ||||||||||||
| 58 | |||||||||||||
| 59 | % cd /path/to/MyApp/bin | ||||||||||||
| 60 | % ./myapp_helper.pl M::FsaveDate | ||||||||||||
| 61 | .......... | ||||||||||||
| 62 | ...... | ||||||||||||
| 63 | |||||||||||||
| 64 | =head1 DESCRIPTION | ||||||||||||
| 65 | |||||||||||||
| 66 | It is a helper who generates the controller to use it with L<Egg::Model::FsaveDate> | ||||||||||||
| 67 | under the control of the project. | ||||||||||||
| 68 | |||||||||||||
| 69 | It starts specifying the Model::FsaveMode mode for the helper script of the | ||||||||||||
| 70 | project to use it. | ||||||||||||
| 71 | |||||||||||||
| 72 | % ./myapp_helper.pl Model::FsaveDate | ||||||||||||
| 73 | |||||||||||||
| 74 | Especially, there is no option needing. | ||||||||||||
| 75 | |||||||||||||
| 76 | =head1 SEE ALSO | ||||||||||||
| 77 | |||||||||||||
| 78 | L<Egg::Release>, | ||||||||||||
| 79 | L<Egg::Model::FsaveDate>, | ||||||||||||
| 80 | L<Egg::Model::FsaveDate::Base>, | ||||||||||||
| 81 | |||||||||||||
| 82 | =head1 AUTHOR | ||||||||||||
| 83 | |||||||||||||
| 84 | Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt> | ||||||||||||
| 85 | |||||||||||||
| 86 | =head1 COPYRIGHT AND LICENSE | ||||||||||||
| 87 | |||||||||||||
| 88 | Copyright (C) 2008 Bee Flag, Corp. E<lt>L<http://egg.bomcity.com/>E<gt>, All Rights Reserved. | ||||||||||||
| 89 | |||||||||||||
| 90 | This library is free software; you can redistribute it and/or modify | ||||||||||||
| 91 | it under the same terms as Perl itself, either Perl version 5.8.6 or, | ||||||||||||
| 92 | at your option, any later version of Perl 5 you may have available. | ||||||||||||
| 93 | |||||||||||||
| 94 | =cut | ||||||||||||
| 95 | |||||||||||||
| 96 | |||||||||||||
| 97 | __DATA__ | ||||||||||||