| MySQL-Admin documentation | Contained in the MySQL-Admin distribution. |
MySQL::Admin::Settings - manage MySQL::Admin properties
use MySQL::Admin::Settings;
use vars qw($m_hrSettings);
*m_hrSettings = \$MySQL::Admin::Settings::m_hrSettings;
loadSettings('./config.pl');
print $m_hrSettings->{key};
$m_hrSettings->{key} = 'value';
saveSettings("./config.pl");
settings for MySQL::Admin.
loadSettings() saveSettings() $m_hrSettings
Dirk Lindner <lze@cpan.org>
Copyright (C) 2005-2009 by Hr. Dirk Lindner
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
| MySQL-Admin documentation | Contained in the MySQL-Admin distribution. |
package MySQL::Admin::Settings; use strict; use warnings; require Exporter; use vars qw($m_hrSettings $DefaultClass @EXPORT @ISA $defaultconfig); @MySQL::Admin::Settings::EXPORT = qw(loadSettings saveSettings $m_hrSettings); use MySQL::Admin::Config; @ISA = qw(Exporter MySQL::Admin::Config); $MySQL::Admin::Settings::VERSION = '0.62'; $DefaultClass = 'MySQL::Admin::Settings' unless defined $MySQL::Admin::Settings::DefaultClass; $defaultconfig = '%CONFIG%';
sub new { my ($class, @initializer) = @_; my $self = {}; bless $self, ref $class || $class || $DefaultClass; return $self; }
sub loadSettings { my ($self, @p) = getSelf(@_); my $do = (defined $p[0]) ? $p[0] : $defaultconfig; if (-e $do) {do $do;} }
sub saveSettings { my ($self, @p) = getSelf(@_); my $l = defined $p[0] ? $p[0] : $defaultconfig; $self->SUPER::saveConfig($l, $m_hrSettings, 'm_hrSettings'); }
sub getSelf { return @_ if defined($_[0]) && (!ref($_[0])) && ($_[0] eq 'MySQL::Admin::Settings'); return (defined($_[0]) && (ref($_[0]) eq 'MySQL::Admin::Settings' || UNIVERSAL::isa($_[0], 'MySQL::Admin::Settings'))) ? @_ : ($MySQL::Admin::Settings::DefaultClass->new, @_); }
1;