-
-
01 Feb 2021 06:49:15 UTC
- Distribution: Config-Plugin-Tiny
- Module version: 1.02
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Repository
- Issues
- Testers (97 / 0 / 0)
- Kwalitee
Bus factor: 1- 93.55% Coverage
- License: perl_5
- Activity
24 month- Tools
- Download (13.42KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors- Ron Savage (ron@savage.net.au)
- Dependencies
- Carp
- Config::Tiny
- strict
- vars
- warnings
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
- NAME
- Synopsis
- Description
- Distributions
- Installation
- Constructor and Initialization
- Methods
- FAQ
- Repository
- See Also
- Machine-Readable Change Log
- Version Numbers
- Credits
- Support
- Author
- Copyright
NAME
Config::Plugin::Tiny - A plugin which uses Config::Tiny
Synopsis
package My::App; use strict; use warnings; use Config::Plugin::Tiny; # For config_tiny(). use File::Spec; # ------------------------------------------------ sub marine { my($self) = @_; my($config) = $self -> config_tiny(File::Spec -> catfile('some', 'dir', 'config.tiny.ini') ); } # End of marine. # -------------------------------------------------- 1;
t/config.tiny.ini ships with the Config::Plugin::Tiny distro, and is used in the test file t/test.t.
Description
When you 'use' this module (as in the Synopsis), it automatically imports into your class the method "config_tiny($file_name)" to give you access to config data stored in an *.ini file.
Distributions
This module is available as a Unix-style distro (*.tgz).
See http://savage.net.au/Perl-modules/html/installing-a-module.html for help on unpacking and installing distros.
Installation
Install Config::Plugin::Tiny as you would for any
Perl
module:Run:
cpanm Config::Plugin::Tiny
or run:
sudo cpan Config::Plugin::Tiny
or unpack the distro, and then either:
perl Build.PL ./Build ./Build test sudo ./Build install
or:
perl Makefile.PL make (or dmake or nmake) make test make install
Constructor and Initialization
This module does not have, and does not need, a constructor.
Methods
config_tiny($file_name)
Returns a *.ini-style config file as a hashref.
Here, the [] indicate an optional parameter.
The $file_name is passed to Config::Tiny's read($file_name) method.
FAQ
When would I use this module?
In your sub-class of CGI::Snapp for example, or anywhere else you want effortless access to a *.ini file.
For example, if you wish to load a config for use by a module such as Log::Handler::Plugin::DBI, try Config::Plugin::Tiny or Config::Plugin::TinyManifold.
Why didn't you call the exported method config()?
Because "config_tiny($file_name)" allows both Config::Plugin::Tiny and Config::Plugin::TinyManifold to be used in the same code.
Can this module be used in any non-CGI-Snapp module?
Yes.
Why don't you 'use Exporter;'?
It is not needed; it would be for documentation only.
For the record, Exporter V 5.567 ships with Perl 5.8.0. That's what I had in Build.PL and Makefile.PL until I tested the fact I can omit it.
What's the error message format?
Every message passed to croak matches /^Error/ and ends with "\n".
Repository
https://github.com/ronsavage/Config-Plugin-Tiny.git
See Also
The following are all part of this set of distros:
CGI::Snapp - A almost back-compat fork of CGI::Application
CGI::Snapp::Demo::One - A template-free demo of CGI::Snapp using just 1 run mode
CGI::Snapp::Demo::Two - A template-free demo of CGI::Snapp using N run modes
CGI::Snapp::Demo::Three - A template-free demo of CGI::Snapp using CGI::Snapp::Plugin::Forward
CGI::Snapp::Demo::Four - A template-free demo of CGI::Snapp using Log::Handler::Plugin::DBI
CGI::Snapp::Demo::Four::Wrapper - A wrapper around CGI::Snapp::Demo::Four, to simplify using Log::Handler::Plugin::DBI
Config::Plugin::Tiny - A plugin which uses Config::Tiny
Config::Plugin::TinyManifold - A plugin which uses Config::Tiny with 1 of N sections
Data::Session - Persistent session data management
Log::Handler::Plugin::DBI - A plugin for Log::Handler using Log::Hander::Output::DBI
Log::Handler::Plugin::DBI::CreateTable - A helper for Log::Hander::Output::DBI to create your 'log' table
Machine-Readable Change Log
The file CHANGES was converted into Changelog.ini by Module::Metadata::Changes.
Version Numbers
Version numbers < 1.00 represent development versions. From 1.00 up, they are production versions.
Credits
Please read https://metacpan.org/module/CGI::Application::Plugin::Config::Simple#AUTHOR, since a lot of the ideas for this module were copied from CGI::Application::Plugin::Config::Simple.
Support
Bugs should be reported via the CPAN bug tracker at
https://github.com/ronsavage/Config-Plugin-Tiny/issues.
Author
Config::Plugin::Tiny was written by Ron Savage <ron@savage.net.au> in 2012.
Home page: http://savage.net.au/index.html.
Copyright
Australian copyright (c) 2012, Ron Savage.
All Programs of mine are 'OSI Certified Open Source Software'; you can redistribute them and/or modify them under the terms of The Artistic License, a copy of which is available at: http://www.opensource.org/licenses/index.html
Module Install Instructions
To install Config::Plugin::Tiny, copy and paste the appropriate command in to your terminal.
cpanm Config::Plugin::Tiny
perl -MCPAN -e shell install Config::Plugin::Tiny
For more information on module installation, please visit the detailed CPAN module installation guide.