From: Ralf Ertzinger Date: Sat, 12 Jan 2008 10:19:11 +0000 (+0100) Subject: - Add feedback for /videosite save X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=commitdiff_plain;ds=sidebyside;h=084471fd4f199ed9bb10eb1b8a423d7ec50f9701;hp=8d289316e0003ee7472b331d9dd65492f78402fd;p=videosite.git - Add feedback for /videosite save --- diff --git a/videosite.pl b/videosite.pl index 847e627..0c5b650 100644 --- a/videosite.pl +++ b/videosite.pl @@ -96,9 +96,16 @@ sub check_for_link { sub cmd_save { - 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: %s', $@); + } else { + write_irssi(undef, 'Saved config'); + } } sub cmd_set {