使用 Config::Simple 读取 MySQL 配置文件,其中的键没有值
Using Config::Simple to read MySQL config file with keys without values
我尝试用 perl 配置我的 mySql 配置文件。
我使用 config::simple 来执行此操作。
我的代码是:
#!/bin/perl
use Config::Simple;
$cfg = new Config::Simple('/etc/mysql/my.cnf');
$cfg->param('bind-address', '192.168.1.11');
$cfg->save();
问题是,当某行只有键而没有值时,我会收到错误消息。我该如何解决这个问题?
扩展 I would suggest using Config::MySQL 以处理 MySQL 配置文件。
Config::MySQL extends Config::INI to support reading and writing
MySQL-style configuration files. Although deceptively similar to
standard .INI files, they can include bare boolean options with no
value assignment and additional features like !include and
!includedir.
我尝试用 perl 配置我的 mySql 配置文件。 我使用 config::simple 来执行此操作。 我的代码是:
#!/bin/perl
use Config::Simple;
$cfg = new Config::Simple('/etc/mysql/my.cnf');
$cfg->param('bind-address', '192.168.1.11');
$cfg->save();
问题是,当某行只有键而没有值时,我会收到错误消息。我该如何解决这个问题?
扩展
Config::MySQL extends Config::INI to support reading and writing MySQL-style configuration files. Although deceptively similar to standard .INI files, they can include bare boolean options with no value assignment and additional features like !include and !includedir.