X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FConfigFromFile.pm;h=07468c4dca6b5f2ae2c6f92b8646b9eba90b195b;hb=491a10839ac9a4bf14e46e04b44cb260f65dfa78;hp=9957047e7f504d54cbaa28ef4d2c694b997521ef;hpb=0d6fca1b801be0477d42dae3bed7b7ade80a1272;p=gitmo%2FMooseX-ConfigFromFile.git diff --git a/lib/MooseX/ConfigFromFile.pm b/lib/MooseX/ConfigFromFile.pm index 9957047..07468c4 100644 --- a/lib/MooseX/ConfigFromFile.pm +++ b/lib/MooseX/ConfigFromFile.pm @@ -108,24 +108,24 @@ MooseX::ConfigFromFile - An abstract Moose role for setting attributes from a co 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. +concrete sub-roles. It declares an attribute C and a class method C, and requires that concrete roles derived from it implement the class method C. -Attributes specified directly as arguments to C supercede those +Attributes specified directly as arguments to C supersede those in the configfile. L knows about this abstract role, and will use it if available -to load attributes from the file specified by the commandline flag C<--configfile> +to load attributes from the file specified by the command line flag C<--configfile> during its normal C. =head1 Attributes =head2 configfile -This is a L object which can be coerced from a regular pathname +This is a L object which can be coerced from a regular path string or any object that supports stringification. This is the file your attributes are loaded from. You can add a default configfile in the consuming class and it will be honored at the appropriate time @@ -152,12 +152,13 @@ C. Example: my $foo = SomeClass->new_with_config(configfile => '/etc/foo.yaml'); -Explicit arguments will overide anything set by the configfile. +Explicit arguments will override anything set by the configfile. =head2 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 +This class method is not implemented in this role, but it is required of all +classes or roles that consume this role. +Its two arguments are the class name and the configfile, and it is expected to return a hashref of arguments to pass to C which are sourced from the configfile. =head1 COPYRIGHT