Config-Std
view release on metacpan or search on metacpan
lib/Config/Std.pm view on Meta::CPAN
Either try again later, or work out who else is using the file.
=item Scalar second argument to 'read_config' must be empty
You passed a scalar variable as the destination into C<read_config()>
was supposed to load a configuration file, but that variable already had
a defined value, so C<read_config()> couldn't autovivify a new hash for
you. Did you mean to pass the subroutine a hash instead of a scalar?
=item Can't save %s value for key '%s' (only scalars or array refs)
You called C<write_config> and passed it a hash containing a
configuration variable whose value wasn't a single string, or a list of
strings. The configuration file format supported by this module only
supports those two data types as values. If you really need to store
other kinds of data in a configuration file, you should consider using
C<Data::Dumper> or C<YAML> instead.
=item Missing filename in call to write_config()
You tried to calll C<write_config()> with only a configuration hash, but that
hash wasn't originally loaded using C<read_config()>, so C<write_config()> has
no idea where to write it to. Either make sure the hash you're trying to save
was originally loaded using C<read_config()>, or else provide an explicit
filename as the second argument to C<write_config()>.
=item Can't open config file '%s' for writing (%s)
You tried to update or create a configuration file, but the file you
specified could not be opened for writing (for the reason given in the
parentheses). This is often caused by incorrect filepaths or lack of
write permissions on a directory.
=item Can't write to locked config file '%s'
You tried to update or create a configuration file, but the file you
specified was being written at the time by someone else (they had a file
lock active on it). Either try again later, or work out who else is
using the file.
=back
=head1 CONFIGURATION AND ENVIRONMENT
Config::Std requires no configuration files or environment variables.
(To do so would be disturbingly recursive.)
=head1 DEPENDENCIES
This module requires the Class::Std module (available from the CPAN)
=head1 INCOMPATIBILITIES
Those variants of INI file dialect supporting partial-line comment are incompatible.
(This is the price of keeping comments when re-writing.)
=head1 BUGS AND LIMITATIONS
=over
=item Memory leak re-reading
A daemon re-reading its config file has reported a memory leak.
=item Parallel testing not safe
This is a config file module. Tests written before C<TAP> got parallel
testing are unsafe with parallel testing, surprise!
Settings are now included to force serial testing (until we refactor all tests
to use temp dirs?).
If using an older Perl < 5.21.1, and Module.PL, and getting out-of-sequence test failures installing this module, either
update Test::Harness~'>= 3.31'
or export HARNESS_OPTIONS=j1
(or force/no-test, or use Build.PL and/or perl-5.22.0 or newer instead).
=item Loading on demand
If you attempt to load C<read_config()> and C<write_config()>
at runtime with C<require>, you can not rely upon the prototype
to convert a regular hash to a reference. To work around this,
you must explicitly pass a reference to the config hash.
require Config::Std;
Config::Std->import;
my %config;
read_config($file, \%config);
write_config(\%config, $file);
=item Windows line endings on Unix/Linux (RT#21547/23550)
If the config file being read contains carriage returns and line feeds
at the end of each line rather than just line feeds (i.e. the standard
Windows file format, when read on a machine expecting POSIX file format),
Config::Std emits an error with embedded newline.
Workaround is match file line-endings to locale.
This will be fixed in 1.000.
=item leading comment vanishes (RT#24597,)
A comment before the first section is not always retained on write-back, if the '' default section is empty.
=back
Please report any bugs or feature requests to
C<bug-config-std@rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org>.
=head1 AUTHOR
Damian Conway C<< <DCONWAY@cpan.org> >>
( run in 2.617 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )