NAME

Hyper::Config::Reader::Context - Object oriented INI Style Config Reader

VERSION

This document describes Hyper::Config::Reader::Context 0.01

SYNOPSIS

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',
});

DESCRIPTION

Context Reader Object, used for reading ini style config files. an initial config file for this object can be generated using Hyper::Generator::Environment.

ATTRIBUTES

context :get

see Hyper::Config::Object::Context

SUBROUTINES/METHODS

BUILD

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.

_read_config :PROTECTED

Internally used to read the config file into an object hierarchy.

DIAGNOSTICS

CONFIGURATION AND ENVIRONMENT

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();

or

'/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();

DEPENDENCIES

  • version

  • Hyper::Config::Reader

  • Class::Std::Storable

  • File::Spec

  • Cwd

  • Hyper::Config::Object::Context

  • Hyper::Config::Object::Default

  • Hyper::Functions

INCOMPATIBILITIES

BUGS AND LIMITATIONS

RCS INFORMATIONS

Last changed by

$Author: ac0v $

Id

$Id: Context.pm 317 2008-02-16 01:52:33Z ac0v $

Revision

$Revision: 317 $

Date

$Date: 2008-02-16 02:52:33 +0100 (Sat, 16 Feb 2008) $

HeadURL

$HeadURL: file:///srv/cluster/svn/repos/Hyper/Hyper/trunk/lib/Hyper/Config/Reader/Context.pm $

AUTHOR

Andreas Specht <ACID@cpan.org>

LICENSE AND COPYRIGHT

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.