App::CLI::Plugin::Config::YAML::Syck - for App::CLI::Extension config plugin module
1.2
# MyApp.pm package MyApp; use strict; use base qw(App::CLI::Extension); # extension method __PACKAGE__->load_plugins(qw(Config::YAML::Syck)); # extension method __PACKAGE__->config( config_file => "/path/to/config.yaml"); 1; # /path/to/config.yaml # --- # name: kurt # age: 27 # MyApp/Hello.pm package MyApp::Hello; use strict; use base qw(App::CLI::Command); sub run { my($self, @argv) = @_; print "Hello! my name is " . $self->config->{name} . "\n"; print "age is " . "$self->config->{age}\n"; } # myapp #!/usr/bin/perl use strict; use MyApp; MyApp->dispatch; # execute [kurt@localhost ~] ./myapp hello Hello! my name is kurt age is 27
App::CLI::Extension YAML::Syck Configuration plugin module
The priority of the config file (name of the execute file in the case of *myapp*)
1. /etc/myapp.yml
2. /usr/local/etc/myapp.yaml
3. $HOME/.myapp.yml
4. $APPCLI_CONFIGFILE(environ variable. if exists)
5. command line option
myapp hello --configfile=/path/to/config.yml
6. config method setting
__PACKAGE__->config(config_file => "/path/to/config.yml");
App::CLI::Extension YAML::Syck
Akira Horimoto
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Copyright (C) 2009 Akira Horimoto
To install App::CLI::Plugin::Config::YAML::Syck, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::CLI::Plugin::Config::YAML::Syck
CPAN shell
perl -MCPAN -e shell install App::CLI::Plugin::Config::YAML::Syck
For more information on module installation, please visit the detailed CPAN module installation guide.