Config-GitLike
view release on metacpan or search on metacpan
- Make ->dump implicitly call ->load as well (alexmv)
- Minor POD fixes (alexmv, spang)
1.05 2011-01-07
- support Module::Install::ExtraTests 0.007 (sunnavy)
- properly set is => 'rw' in inherited classes (trs, alexmv)
- silence lc warnings on undef under perl 5.12 (iarnell@gmail.com)
1.04 2010-04-03
- The functionality of Config::GitLike::Cascaded has been folded into
Config::GitLike as a "cascade" option, and the subpackage is now
deprecated. (alexmv)
- Config::GitLike::Git->new->load("/path/to/git") when the path is lacking
a ".git", or is a bare repository, now works. (alexmv)
- Fixed a bug wherein the home directory config file would be loaded
twice, causing all values to be multiple, if that was your cwd. Reported
by rjbs. (alexmv)
- Allow explicitly calling ->load_file without previously having called
->load (alexmv)
1.03 2010-01-03
lib/Config/GitLike.pm view on Meta::CPAN
);
# default to being more relaxed than git, but allow enforcement
# of only-write-things-that-git-config-can-read if you want to
has 'compatible' => (
is => 'rw',
isa => Bool,
default => sub { 0 },
);
has 'cascade' => (
is => 'rw',
isa => Bool,
default => sub { 0 },
);
has 'encoding' => (
is => 'rw',
isa => Maybe[Str],
);
lib/Config/GitLike.pm view on Meta::CPAN
my $path = shift;
my($vol, $dirs, undef) = File::Spec->splitpath( $path, 1 );
my @dirs = File::Spec->splitdir( $dirs );
my @found;
while (@dirs) {
my $path = File::Spec->catpath(
$vol, File::Spec->catdir(@dirs), $self->dir_file
);
if (-f $path) {
push @found, $path;
last unless $self->cascade;
}
pop @dirs;
}
$self->load_file( $_ ) for reverse @found;
}
sub global_file {
my $self = shift;
return "/etc/" . $self->confname;
}
lib/Config/GitLike.pm view on Meta::CPAN
semicolon => 0,
Add a comment to the specified configuration file. The C<comment> and
C<filename> parameters are required. Comments will be added to the file with
C<# > at the begnning of each line of the comment. Pass a true value to
C<semicolon> if you'd rather they start with C<; >. If your comments are
indented with leading white space, and you want that white space to appear in
front of the comment character, rather than after, pass a true value to
C<indented>.
=head2 cascade( $bool )
Gets or sets if only the B<deepest> configuration file in a directory
tree is loaded, or if all of them are loaded, shallowest to deepest.
Alternately, C<cascade =E<gt> 1> can be passed to C<new>.
=head2 origins
Returns a hash mapping each config key with the file it was loaded from.
=head1 METHODS YOU MAY WISH TO OVERRIDE
If your application's configuration layout is different from the default, e.g.
if its home directory config files are in a directory within the home
directory (like C<~/.git/config>) instead of just dot-prefixed, override these
lib/Config/GitLike/Cascaded.pm view on Meta::CPAN
package Config::GitLike::Cascaded;
use Moo;
use Cwd;
use File::Spec;
extends 'Config::GitLike';
has 'cascade' => (
default => sub { 1 },
is => 'rw',
);
__PACKAGE__->meta->make_immutable;
no Moo;
1;
__END__
=head1 NAME
Config::GitLike::Cascaded - git-like config file parsing with cascaded inheritance
=head1 SYNOPSIS
This module exists purely for backwards compatibility; its use is
deprecated, and will be removed in a future release.
=head1 METHODS
=head2 cascade
This module simply defaults L<Config::GitLike/cascade> to a true value.
=head1 SEE ALSO
L<Config::GitLike|Config::GitLike>
=head1 LICENSE
You may modify and/or redistribute this software under the same terms
as Perl 5.8.8.
( run in 0.471 second using v1.01-cache-2.11-cpan-49f99fa48dc )