BE4::PropertiesLoader

Exporter
BE4::PropertiesLoader

Reads a configuration file, to sIniFiles* format

Using

use BE4::PropertiesLoader;

my $proptxt << EOF
    [section 1]
    param1=value1
    param2=value2
    [section 2]
    ; param21=value21
    ; param22=value22
EOF

open FILE, ">", $propfile;
printf FILE "%s",  $proptxt;
close FILE;

my $objprop = BE4::PropertiesLoader->new($propfile);

# {section 1 => {...}, section 2 => {...}}
my $config     = $objprop->getAllProperties();

my @sections   = $objprop->getSections();  # [section 1, section 2]
my @parameters = $objprop->getKeyParameters("section 1"); # [param1, param2]
my @values     = $objprop->getValueParameters("section 1"); # [value1, value2]

# {param1=>value1, param2=>value2}
my $config_section = $objprop->getPropertiesBySection("section 1");
...

Attributes

CFGFILEstring - Configuration file path
HDLFILE<Config::IniFiles> - Configuration reader
CFGPARAMShash - File properties (sections...)

Constructors

new

sub new

_initParams

sub _initParams

_initCfg

sub _initCfg

Loader

LoadProperties

sub LoadProperties

Getters - Setters

getAllProperties

sub getAllProperties

getPropertiesBySection

sub getPropertiesBySection

getSections

sub getSections

getKeyParameters

sub getKeyParameters

getValueParameters

sub getValueParameters
sub new
sub _initParams
sub _initCfg
sub LoadProperties
sub getAllProperties
sub getPropertiesBySection
sub getSections
sub getKeyParameters
sub getValueParameters
Close