Config-Autoload
view release on metacpan or search on metacpan
lib/Config/Autoload.pm view on Meta::CPAN
if ( ! -f $file ) {
croak "The config file doesn't exist";
} elsif ( ! -r $file ) {
croak "The config file isn't readable";
}
if ( defined($construct) && ref($construct) ne 'CODE' ) {
croak "The second argument for new() must be a coderef";
}
my $mtime = (stat($file))[9];
my $c;
if ( defined $construct ) {
$c = $construct->($file);
unless (ref($c) eq 'HASH') {
croak "Not a hashref returned from the subroutine";
}
} else {
$c = _construct($file);
}
lib/Config/Autoload.pm view on Meta::CPAN
my $file = $self->{file};
if ( ! -f $file ) {
for (0..3) {
select(undef,undef,undef,0.25);
last if -f $file;
}
}
croak "The config file seems not exists" unless -f $file;
my $mtime = (stat($file))[9];
if ( $mtime != $self->{mtime} ) {
$self = __PACKAGE__->new($file,$self->{construct});
}
return $self->{c}->{$key};
}
1;
( run in 0.479 second using v1.01-cache-2.11-cpan-49f99fa48dc )