equal
deleted
inserted
replaced
|
1 package Imager; |
|
2 use 5.010; |
|
3 use strict; |
|
4 use warnings; |
|
5 use IO::Uncompress::Gunzip qw(gunzip $GunzipError); |
|
6 use autodie qw(:all); |
|
7 |
|
8 use constant CIPHER => "aes-128-cbc"; |
|
9 |
|
10 sub get_block { |
|
11 my ($file, $buffer) = @_; |
|
12 |
|
13 given ($file) { |
|
14 when (/\.gz\.x$/) { |
|
15 open(my $fh => "openssl @{[CIPHER]} -d -pass $::o{pass} -in $file|"); |
|
16 local $/ = undef; |
|
17 gunzip($fh => $buffer) or die $GunzipError; |
|
18 } |
|
19 when (/\.gz$/) { gunzip($file => $buffer) or die $GunzipError } |
|
20 when (/\.x$/) { |
|
21 open(my $fh => "openssl @{[CIPHER]} -d -pass $::o{pass} -in $file|"); |
|
22 local $/ = undef; |
|
23 $$buffer = <$fh>; |
|
24 } |
|
25 default { open(my $fh => $file); local $/ = undef; $$buffer = <$fh> } |
|
26 } |
|
27 } |
|
28 |
|
29 1; |