From: Karen Etheridge Date: Sun, 3 Feb 2013 02:10:20 +0000 (-0800) Subject: autogenerate README and LICENSE X-Git-Tag: 0.05~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=097fca8f8aa39c3111a01edf4d1f16cf0d660280;p=gitmo%2FMooseX-ConfigFromFile.git autogenerate README and LICENSE --- diff --git a/Makefile.PL b/Makefile.PL index 71bd50c..f550eb5 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,8 +1,13 @@ # Load the Module::Install bundled in ./inc/ use inc::Module::Install 0.75; +use Module::Install::ReadmeFromPod; +use Module::Install::AutoLicense; + name 'MooseX-ConfigFromFile'; -all_from 'lib/MooseX/ConfigFromFile.pm'; +all_from 'lib/MooseX/ConfigFromFile.pm'; +readme_from 'lib/MooseX/ConfigFromFile.pm'; +auto_license; test_requires 'Test::More' => '0.42'; test_requires 'Test::Fatal'; @@ -17,7 +22,4 @@ requires 'namespace::autoclean'; resources repository => 'git://git.moose.perl.org/MooseX-ConfigFromFile.git'; -# Rebuild README for maintainers -system("pod2text lib/MooseX/ConfigFromFile.pm >README") if $Module::Install::AUTHOR; - WriteAll; diff --git a/README b/README deleted file mode 100644 index 03072a2..0000000 --- a/README +++ /dev/null @@ -1,106 +0,0 @@ -NAME - MooseX::ConfigFromFile - An abstract Moose role for setting attributes - from a configfile - -SYNOPSIS - ######## - ## A real role based on this abstract role: - ######## - - package MooseX::SomeSpecificConfigRole; - use Moose::Role; - - with 'MooseX::ConfigFromFile'; - - use Some::ConfigFile::Loader (); - - sub get_config_from_file { - my ($class, $file) = @_; - - my $options_hashref = Some::ConfigFile::Loader->load($file); - - return $options_hashref; - } - - - ######## - ## A class that uses it: - ######## - package Foo; - use Moose; - with 'MooseX::SomeSpecificConfigRole'; - - # optionally, default the configfile: - sub configfile { '/tmp/foo.yaml' } - - # ... insert your stuff here ... - - ######## - ## A script that uses the class with a configfile - ######## - - my $obj = Foo->new_with_config(configfile => '/etc/foo.yaml', other_opt => 'foo'); - -DESCRIPTION - This is an abstract role which provides an alternate constructor for - creating objects using parameters passed in from a configuration file. - The actual implementation of reading the configuration file is left to - concrete subroles. - - It declares an attribute "configfile" and a class method - "new_with_config", and requires that concrete roles derived from it - implement the class method "get_config_from_file". - - Attributes specified directly as arguments to "new_with_config" - supercede those in the configfile. - - MooseX::Getopt knows about this abstract role, and will use it if - available to load attributes from the file specified by the commandline - flag "--configfile" during its normal "new_with_options". - -Attributes - configfile - This is a Path::Class::File object which can be coerced from a regular - pathname string. This is the file your attributes are loaded from. You - can add a default configfile in the class using the role and it will be - honored at the appropriate time: - - has +configfile ( default => '/etc/myapp.yaml' ); - - Note that you can alternately just provide a "configfile" method which - returns the config file when called - this will be used in preference to - the default of the attribute. - -Class Methods - new_with_config - This is an alternate constructor, which knows to look for the - "configfile" option in its arguments and use that to set attributes. It - is much like MooseX::Getopts's "new_with_options". Example: - - my $foo = SomeClass->new_with_config(configfile => '/etc/foo.yaml'); - - Explicit arguments will overide anything set by the configfile. - - get_config_from_file - This class method is not implemented in this role, but it is required of - all subroles. Its two arguments are the classname and the configfile, - and it is expected to return a hashref of arguments to pass to "new()" - which are sourced from the configfile. - -COPYRIGHT - Copyright (c) 2007 - 2009 the MooseX::ConfigFromFile "AUTHOR" and - "CONTRIBUTORS" as listed below. - -AUTHOR - Brandon L. Black, - -CONTRIBUTORS - Tomas Doran "" (current maintainer). - Karen Etheridge - Chris Prather - Zbigniew Lukasiak - -LICENSE - This library is free software; you can redistribute it and/or modify it - under the same terms as Perl itself. -