Config-Trivial-Storable

 view release on metacpan or  search on metacpan

lib/Config/Trivial/Storable.pm  view on Meta::CPAN

    configuration => $settings);

The method returns true on success. If the file already exists
then it is backed up first. The store takes place using Storable's
"lock_store" which uses Perl's flock. If the file cannot be
written to then it will die.

Configuration data passed by this method is only written to
file, it is not stored in the internal configuration object.
To store data in the internal use the set_configuration data
method. The option to pass a hash_ref in this method may
be removed in future versions.

If you do not specify a file name then the module will default to
writing to the calling file - which is obviously silly and it will
try to avoid doing this - hence the error message:
"Can't retrieve store from the calling file.".

=head2 retrieve

This is the analogue to read, only it reads data from a Storable binary.

  $config->retrieve;

If both Storable and traditional text configuration files are set then
retrieve will use the Storable version in preference, but if the text
version is newer then that will be used instead. Thus you can easily
edit the text version and any code using this module will automatically
switch to using it.

=head2 set_storable_file

If you want to explicitly set the file name of a storable file
you may use this method. If you set a file name by both set_storable_file
and set_config_file, then the retrieve method will "magically" decided
which to use. The read method will ignore any storable settings.

=head1 CONFIG FORMAT

=head2 About The Configuration File Format

This module extends C<Config::Trivial> with optional support for using
Storable binaries as a configuration file format, rather than plain
text files.

The format of the text files is as with C<Config::Trivial> and remains
unchanged, as this module inherits from that one. The Storable format
is offered so that modules can simple "retrieve" their configuration
without the use of any particular configuration module.

This module extends C<Config::Trivial> so that they can be used to quickly
read configuration in one format and convert to another.

=head1 DEPENDENCIES

At the moment the module only uses core modules, plus C<Config::Trivial>
The test suite optionally uses C<POD::Coverage>, C<Test::Pod::Coverage>,
C<Test::Pod> and C<IO::Warnings> which will be skipped if you do not
have them.

=head1 BUGS AND LIMITATIONS

Patches very welcome... ;-)

=head1 MISC

=head2 History

See Changes file.

=head1 EXPORT

None.

=head1 AUTHOR

Adam Trickett, E<lt>atrickett@cpan.orgE<gt>

=head1 SEE ALSO

L<perl>, L<Config::Trivial>, L<Storable>.

=head1 LICENSE AND COPYRIGHT

This version as C<Config::Trivial::Storable>, Copyright Adam John Trickett 2006-2014

OSI Certified Open Source Software.
Free Software Foundation Free Software.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

=cut



( run in 1.351 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )