Net::Async::Webservice::Common::WithConfigFile - automatically load constructor args from a config file
version 1.0.2
package My::WS::Client { use Moo; with 'Net::Async::Webservice::Common::WithConfigFile'; has param => (is => 'ro', required => 1); } my $c = My::WS::Client->new({config_file=>'/etc/my.conf'});
This role wraps BUILDARGS and, if a config_file argument was passed to the constructor, loads that file with Config::Any and adds the values loaded to the arguments (explicitly passed constructor arguments still take precedence).
BUILDARGS
config_file
MooX::ConfigFromFile for a more comprehensive solution.
Gianni Ceccarelli <gianni.ceccarelli@net-a-porter.com>
This software is copyright (c) 2014 by Net-a-porter.com.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Net::Async::Webservice::Common, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Async::Webservice::Common
CPAN shell
perl -MCPAN -e shell install Net::Async::Webservice::Common
For more information on module installation, please visit the detailed CPAN module installation guide.