diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2009-05-31 12:44:05 +0200 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2009-05-31 12:44:05 +0200 |
commit | a5ab00c5427d9e3b97b08d7c4570fb2b782bf696 (patch) | |
tree | 3c6e91f1d5d05fbac31c4cbae330d5de9ffba194 | |
parent | ebb007a0f9ae3b2eb7da8e2bdb8d07f229799f69 (diff) |
Simplestore.pm: Use Carp (→confess)
-rwxr-xr-x | lib/Simplestore.pm | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Simplestore.pm b/lib/Simplestore.pm index aea8b2b..e5d060e 100755 --- a/lib/Simplestore.pm +++ b/lib/Simplestore.pm @@ -4,6 +4,7 @@ ## License: WTFPL <http://sam.zoy.org/wtfpl> use strict; use warnings; +use Carp; our (@ISA, @EXPORT, $VERSION); require Exporter; @@ -15,7 +16,7 @@ sub load { my $file = shift; my ($store, $key, $value); $store = shift if @_; - open(my $handle, '<', $file) or die("Cannot read $file: $!"); + open(my $handle, '<', $file) or confess("Cannot read $file: $!"); while (<$handle>) { chomp; /^(\S+)\s+(.*)$/ or next; @@ -33,7 +34,7 @@ sub load { sub save { my ($file, $store) = @_; my $key; - open(my $handle, '>', $file) or die("Cannot open $file: $!"); + open(my $handle, '>', $file) or confess("Cannot open $file: $!"); foreach $key (keys(%$store)) { foreach (split(/\n/, $store->{$key})) { print $handle "$key\t$_\n"; |