package Local::Config; use strict; use vars qw/$VERSION @ISA @EXPORT @EXPORT_OK/; require Exporter; require AutoLoader; @ISA = qw/Exporter AutoLoader/; @EXPORT_OK = qw//; $VERSION = '0.24'; use App::Config; sub define { my $self = shift; return undef unless defined $self->{config}; my $arg = @_; if (ref($arg) eq 'HASH') { $self->{config}->define($_, ${$arg}{$_}) foreach keys %{$arg}; }; return; }; sub get { my $self = shift; return $self->{config}->get(@_); }; sub load ($) { my $self = shift; return undef unless -e $_[0]; return $self->{config}->cfg_file($_[0]); }; sub new { my $param = shift; my $class = ref($param) || $param; my $self = {}; bless ($self, $class); my $args = (ref($_[0]) eq 'HASH') ? $_[0] : {}; $self->{config} = App::Config->new(\%{$args}); if (ref($_[1]) eq 'HASH') { $self->{config}->define($_, ${$_[1]}{$_}) foreach keys %{$_[1]}; }; return $self; }; sub set { my $self = shift; return $self->{config}->set(@_); }; 1; __END__