Hyper::Config::Reader::Context - Object oriented INI Style Config Reader
This document describes Hyper::Config::Reader::Context 0.01
use Hyper::Config::Reader::Context; my $context_reader = Hyper::Config::Reader::Context->new({ base_path => '/srv/web/www.example.com/', file => '/srv/web/www.example.com/etc/MyPortal/Context.ini', });
Context Reader Object, used for reading ini style config files. an initial config file for this object can be generated using Hyper::Generator::Environment.
see Hyper::Config::Object::Context
use Hyper::Config::Reader::Context; my $object = Hyper::Config::Reader::Context->new();
or
use Hyper::Config::Reader::Context; my $object = Hyper::Config::Reader::Context->new({ base_path => '/srv/web/www.example.com/', });
Adjust some defaults and reads the config file. The hash ref param with the key base_path is used to adjust base path for the config file.
Internally used to read the config file into an object hierarchy.
Sample for an Context.ini (eg. located at /srv/web/www.example.com/etc/MyPortal/Context.ini)
[Global] base_path=srv/web/www.example.com/ namespace=MyPortal [Class] translator=Hyper.Translator.Noop template=Hyper.Template.HTC application=Hyper.Application.Default [Hyper::Application::Default] ;template=index.htc [Hyper::Persistence] cache_path=/tmp [Hyper::Error] ;plain_template=Hyper/Error/plain_error.htc ;html_template=Hyper/Error/html_error.htc
You can access the config via some object methods.
'Hyper.Translator.Noop' eq $object->get_context() ->get_config('Class')->get_translator();
'/tmp' eq $object->get_context() ->get_config('Hyper::Error')->get_cache_path();
or using caller package instead of fixed param for get_config
package Hyper::Error; '/tmp' eq $object->get_context() ->get_config()->get_cache_path();
version
Hyper::Config::Reader
Class::Std::Storable
File::Spec
Cwd
Hyper::Config::Object::Context
Hyper::Config::Object::Default
Hyper::Functions
$Author: ac0v $
$Id: Context.pm 317 2008-02-16 01:52:33Z ac0v $
$Revision: 317 $
$Date: 2008-02-16 02:52:33 +0100 (Sa, 16 Feb 2008) $
$HeadURL: http://svn.hyper-framework.org/Hyper/Hyper/tags/0.05/lib/Hyper/Config/Reader/Context.pm $
Andreas Specht <ACID@cpan.org>
<ACID@cpan.org>
Copyright (c) 2007, Andreas Specht <ACID@cpan.org>. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Hyper, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Hyper
CPAN shell
perl -MCPAN -e shell install Hyper
For more information on module installation, please visit the detailed CPAN module installation guide.