App-Padadoy
view release on metacpan or search on metacpan
bin/padadoy view on Meta::CPAN
# TODO: There should be a CPAN module to do this:
sub find_config {
my $path = cwd;
while ($path) {
my $file = catfile($path,'padadoy.yml');
return $file if -e $file;
last if $path eq dirname($path);
$path = dirname($path);
}
my ($login) = getpwuid($<);
my $file = catdir('/home',$login,'padadoy.yml');
return -e $file ? $file : '';
}
$config //= find_config;
# Parse config file and values
my $values = $config ne '' ? LoadFile( $config ) : { };
my $regexp = qr{^([a-z]+)=(.*)$};
foreach (@ARGV) {
lib/App/Padadoy.pm view on Meta::CPAN
};
$self->{base} = rel2abs(dirname($config));
} else {
$self->{base} = $values{base} // cwd;
}
foreach (@configs) {
$yaml->{$_} = $values{$_} if defined $values{$_};
}
$self->{user} = $yaml->{user} || getlogin || getpwuid($<);
$self->{repository} = $yaml->{repository} || catdir($self->{base},'repository');
$self->{port} = $yaml->{port} || 6000;
$self->{pidfile} = $yaml->{pidfile} || catfile($self->{base},'starman.pid');
$self->{remote} = $yaml->{remote};
# config file
$self->{config} = $config;
# TODO: validate config values
( run in 0.237 second using v1.01-cache-2.11-cpan-8d75d55dd25 )