http://qs321.pair.com?node_id=348967


in reply to binmode binmoding binmode again
in thread Problem Encoding/Decoding PDF with MIME::Base64

Thanks PodMaster, that was it precisely. I rewrote the programs as follows:

encode_base64.pl:

#! /usr/bin/perl use strict; use MIME::Base64 qw( encode_base64 ); open INFILE, '<', $ARGV[0]; binmode INFILE; open OUTFILE, '>', $ARGV[1]; my $buf; while ( read( INFILE, $buf, 60 * 57 ) ) { print OUTFILE encode_base64( $buf ); } close OUTFILE; close INFILE; __END__

decode_base64.pl:

#! /usr/bin/perl use strict; use MIME::Base64 qw( decode_base64 ); open INFILE, '<', $ARGV[0]; open OUTFILE, '>', $ARGV[1]; binmode OUTFILE; my $buf; while ( $buf = <INFILE> ) { print OUTFILE decode_base64( $buf ); } close OUTFILE; close INFILE; __END__

The PDF decoded correctly this time. Thanks!


_______________
DamnDirtyApe
Those who know that they are profound strive for clarity. Those who
would like to seem profound to the crowd strive for obscurity.
            --Friedrich Nietzsche