Config-Simple
view release on metacpan or search on metacpan
sub write {
my ($self, $file) = @_;
$file ||= $self->{_FILE_NAME} or die "Neither '_FILE_NAME' nor \$filename defined";
unless ( sysopen(FH, $file, O_WRONLY|O_CREAT, 0666) ) {
$self->error("'$file' couldn't be opened for writing: $!");
return undef;
}
unless ( flock(FH, LOCK_EX) ) {
$self->error("'$file' couldn't be locked: $!");
return undef;
}
unless ( truncate(FH, 0) ) {
$self->error("'$file' couldn't be truncated: $!");
return undef;
}
print FH $self->as_string();
unless ( CORE::close(FH) ) {
$self->error("Couldn't write into '$file': $!");
return undef;
( run in 0.512 second using v1.01-cache-2.11-cpan-49f99fa48dc )