Skip to content

Commit

Permalink
Conversion to Any::Moose
Browse files Browse the repository at this point in the history
  • Loading branch information
robertkrimen committed Dec 29, 2010
1 parent 115f213 commit 0f99be7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 32 deletions.
2 changes: 1 addition & 1 deletion dist.ini
Expand Up @@ -20,6 +20,6 @@ Clone = 0
Data::Visitor = 0.24
Hash::Merge::Simple = 0
List::MoreUtils = 0
Moose = 0
Any::Moose = 0
Path::Class = 0
Sub::Install = 0
29 changes: 9 additions & 20 deletions lib/Config/JFDI.pm
Expand Up @@ -77,7 +77,7 @@ If you *do* want the original behavior, simply pass in the file parameter as the
=cut

use Moose;
use Any::Moose;

use Config::JFDI::Source::Loader;
use Config::JFDI::Carp;
Expand All @@ -89,44 +89,33 @@ use Sub::Install;
use Data::Visitor::Callback;
use Clone qw//;

has package => qw/is ro isa Str/;
has package => qw/ is ro isa Str /;

has source => qw/is ro/, handles => [qw/ driver local_suffix no_env env_lookup path found /];
has source => qw/ is ro /, handles => [qw/ driver local_suffix no_env env_lookup path found /];

#has driver => qw/is ro lazy_build 1/;
#sub _build_driver {
# return {};
#}
has load_once => qw/ is ro required 1 /, default => 1;

#has local_suffix => qw/is ro required 1 lazy 1 default local/;
has loaded => qw/ is ro required 1 /, default => 0;

#has no_env => qw/is ro required 1/, default => 0;

#has env_lookup => qw/is ro/, default => sub { [] };

has load_once => qw/is ro required 1/, default => 1;

has loaded => qw/is ro required 1/, default => 0;

has substitution => qw/reader _substitution lazy_build 1 isa HashRef/;
has substitution => qw/ reader _substitution lazy_build 1 isa HashRef /;
sub _build_substitution {
return {};
}

has default => qw/is ro lazy_build 1 isa HashRef/;
has default => qw/ is ro lazy_build 1 isa HashRef /;
sub _build_default {
return {};
}

has path_to => qw/reader _path_to lazy_build 1 isa Str/;
has path_to => qw/ reader _path_to lazy_build 1 isa Str /;
sub _build_path_to {
my $self = shift;
return $self->config->{home} if $self->config->{home};
return $self->source->path unless $self->source->path_is_file;
return '.';
}

has _config => qw/is rw isa HashRef/;
has _config => qw/ is rw isa HashRef /;

=head2 $config = Config::JFDI->new(...)
Expand Down
22 changes: 11 additions & 11 deletions lib/Config/JFDI/Source/Loader.pm
@@ -1,33 +1,33 @@
package Config::JFDI::Source::Loader;

use Moose;
use Any::Moose;

use Config::Any;
use Carp;
use List::MoreUtils qw/any/;
use List::MoreUtils qw/ any /;

has name => qw/is ro required 0 isa Str|ScalarRef/;
has name => qw/ is ro required 0 isa Str|ScalarRef /;

has path => qw/is ro default ./;
has path => qw/ is ro default . /;

has driver => qw/is ro lazy_build 1/;
has driver => qw/ is ro lazy_build 1 /;
sub _build_driver {
return {};
}

has local_suffix => qw/is ro required 1 lazy 1 default local/;
has local_suffix => qw/ is ro required 1 lazy 1 default local /;

has no_env => qw/is ro required 1/, default => 0;
has no_env => qw/ is ro required 1 /, default => 0;

has no_local => qw/is ro required 1/, default => 0;
has no_local => qw/ is ro required 1 /, default => 0;

has env_lookup => qw/is ro/, default => sub { [] };
has env_lookup => qw/ is ro /, default => sub { [] };

has path_is_file => qw/is ro default 0/;
has path_is_file => qw/ is ro default 0 /;

has _found => qw/ is rw isa ArrayRef /;

sub _env(@) {
sub _env (@) {
my $key = uc join "_", @_;
$key =~ s/::/_/g;
$key =~ s/\W/_/g;
Expand Down

0 comments on commit 0f99be7

Please sign in to comment.