package Egg::Helper::Build::Plugin; # # Masatoshi Mizuno ElusheE<64>cpan.orgE # # $Id: Plugin.pm 337 2008-05-14 12:30:09Z lushe $ # use strict; use warnings; use base qw/ Egg::Helper::Build::Module /; our $VERSION= '3.00'; sub _start_helper { my($self)= @_; my $c= $self->config; $c->{helper_option}{project_root} || return $self->_helper_help ('I want you to start from helper of the project.'); my $plugin_name= shift(@ARGV) || return $self->_helper_help('I want plugin name.'); if ($plugin_name=~m{^\+}) { $plugin_name=~s{^\++} []; } elsif ($plugin_name!~m{^Egg(?:\:+|\-)Plugin}) { $plugin_name=~s{^(?:\:|\-)+} []; $plugin_name= "Egg::Plugin::$plugin_name"; } my $parts= $self->helper_mod_name_split($plugin_name) || return $self->_helper_help('Bad format of plugin name.'); my $o= $self->_helper_get_options; my $version= $self->helper_valid_version_number($o->{version}) || return 0; my $param = $self->helper_prepare_param({ output_path => ($o->{output} || undef), module_version => $version, module_generator => __PACKAGE__, }); $self->helper_prepare_param_module($param, $parts); my $plugin_path= $param->{module_output_filepath}= "$param->{output_path}/lib/$param->{module_filepath}"; -e $plugin_path and return $self->_helper_help("$plugin_path A already exists."); $self->helper_generate_files( param => $param, chdir => [$param->{output_path}], create_files => [$self->helper_mod_template->[0]], errors => { unlink=> [$plugin_path] }, complete_msg => "\nPlugin generate is completed.\n\n" . "output path : $plugin_path\n" ); $self; } sub _helper_help { my $self = shift; my $msg = shift || ""; my $pname= lc $self->project_name; $msg= "ERROR: ${msg}\n\n" if $msg; print < for the method of making the plugin module. =head1 SEE ALSO L, L, L, L, =head1 AUTHOR Masatoshi Mizuno ElusheE<64>cpan.orgE =head1 COPYRIGHT AND LICENSE Copyright (C) 2008 Bee Flag, Corp. ELE. 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. =cut