X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=bin%2Fbro-perl;h=45eed8e3dff125d2ea7463335b0e738904195bc2;hb=7e5e9e1b9590458bd563640c4adbc70c00403d91;hp=6aac129481f9ac5dcc86ad11caaae5f314777acc;hpb=64dc5d656629b78de7a8f90a15d164eac8f73ba2;p=io-compress-brotli.git diff --git a/bin/bro-perl b/bin/bro-perl index 6aac129..45eed8e 100755 --- a/bin/bro-perl +++ b/bin/bro-perl @@ -1,11 +1,10 @@ #!perl -# use warnings; use strict; use 5.014; -use bytes; +use bytes (); use File::Slurp; use Getopt::Long; @@ -54,7 +53,7 @@ for ( 1..$REPEAT ) { my $ofh; if( $OUTPUT ) { - die "Output file exists" + die "Output file exists\n" if( -e $OUTPUT && $REPEAT == 1 && !$FORCE ); open $ofh, ">", $OUTPUT or die "Cannot open output file $OUTPUT.\n"; @@ -85,17 +84,16 @@ for ( 1..$REPEAT ) { $bro->window( $WINDOW ); while( read $ifh, (my $buf), $STREAM ) { $encoded = $bro->compress($buf); - $total_size += bytes::length( $encoded ); + $total_size += bytes::length( $buf ); print $ofh $encoded; } $encoded = $bro->finish(); - $total_size += bytes::length( $encoded ); print $ofh $encoded; } else { my $decoded = read_file( $ifh ); my $encoded = bro( $decoded, $QUALITY, $WINDOW ); - $total_size += bytes::length( $encoded ); + $total_size += bytes::length( $decoded ); write_file( $ofh, $encoded ); } }