diff options
author | Guillem Jover <guillem@debian.org> | 2014-01-15 19:11:41 +0100 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2014-01-15 19:11:41 +0100 |
commit | ca3e9ea4a3d218f1605757355ee88ca1572d5bb2 (patch) | |
tree | bf8907eba37844cec414d435b6d6371b7acdd0fc /scripts/Dpkg/Compression | |
parent | 8f7135323abb5707c6e93284929c60ed667d99c6 (diff) | |
download | dpkg-ca3e9ea4a3d218f1605757355ee88ca1572d5bb2.tar.gz |
Dpkg::Compression::FileHandle: Use croak instead of error on programming errors
Diffstat (limited to 'scripts/Dpkg/Compression')
-rw-r--r-- | scripts/Dpkg/Compression/FileHandle.pm | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/scripts/Dpkg/Compression/FileHandle.pm b/scripts/Dpkg/Compression/FileHandle.pm index a214ea4a2..391728c26 100644 --- a/scripts/Dpkg/Compression/FileHandle.pm +++ b/scripts/Dpkg/Compression/FileHandle.pm @@ -382,8 +382,11 @@ sub get_filehandle { sub open_for_write { my ($self) = @_; - error("Can't reopen an already opened compressed file") if exists *$self->{mode}; my $filehandle; + + croak 'cannot reopen an already opened compressed file' + if exists *$self->{mode}; + if ($self->use_compression()) { *$self->{compressor}->compress(from_pipe => \$filehandle, to_file => $self->get_filename()); @@ -397,8 +400,11 @@ sub open_for_write { sub open_for_read { my ($self) = @_; - error("Can't reopen an already opened compressed file") if exists *$self->{mode}; my $filehandle; + + croak 'cannot reopen an already opened compressed file' + if exists *$self->{mode}; + if ($self->use_compression()) { *$self->{compressor}->uncompress(to_pipe => \$filehandle, from_file => $self->get_filename()); |