- open(CONF, '>'.$conffile);
- print CONF XML::Simple::XMLout($conf, KeepRoot => 1, KeyAttr => {'config' => 'module', 'option' => 'key'});
- close(CONF);
+ eval {
+ open(CONF, '>'.$conffile) or die 'Could not open config file';
+ print CONF XML::Simple::XMLout($conf, KeepRoot => 1, KeyAttr => {'config' => 'module', 'option' => 'key'});
+ close(CONF);
+ };
+ if ($@) {
+ write_irssi(undef, 'Could not save config to %s: %s', ($conffile, $@));
+ } else {
+ write_irssi(undef, 'configuration saved to %s', $conffile);
+ }