From: Tomas Doran Date: Wed, 4 Nov 2009 09:20:57 +0000 (+0000) Subject: Trim trailing whitespace X-Git-Tag: 0.04~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=118437b37ed790a6dd4b8e1d9b76e8c161ab736b;p=gitmo%2FMooseX-SimpleConfig.git Trim trailing whitespace --- diff --git a/lib/MooseX/SimpleConfig.pm b/lib/MooseX/SimpleConfig.pm index 056bdfd..eecfd98 100644 --- a/lib/MooseX/SimpleConfig.pm +++ b/lib/MooseX/SimpleConfig.pm @@ -11,7 +11,7 @@ sub get_config_from_file { my ($class, $file) = @_; my $can_config_any_args = $class->can('config_any_args'); - my $extra_args = $can_config_any_args ? + my $extra_args = $can_config_any_args ? $can_config_any_args->($class, $file) : {}; ; my $raw_cfany = Config::Any->load_files({ @@ -49,45 +49,45 @@ MooseX::SimpleConfig - A Moose role for setting attributes from a simple configf foo: bar baz: 123 - ## In your class + ## In your class package My::App; use Moose; - + with 'MooseX::SimpleConfig'; - + has 'foo' => (is => 'ro', isa => 'Str', required => 1); has 'baz' => (is => 'rw', isa => 'Int', required => 1); - + # ... rest of the class here - + ## in your script #!/usr/bin/perl - + use My::App; - + my $app = My::App->new_with_config(configfile => '/etc/my_app.yaml'); # ... rest of the script here #################### ###### combined with MooseX::Getopt: - ## In your class + ## In your class package My::App; use Moose; - + with 'MooseX::SimpleConfig'; with 'MooseX::Getopt'; - + has 'foo' => (is => 'ro', isa => 'Str', required => 1); has 'baz' => (is => 'rw', isa => 'Int', required => 1); - + # ... rest of the class here - + ## in your script #!/usr/bin/perl - + use My::App; - + my $app = My::App->new_with_options(); # ... rest of the script here