in reply to Re^3: line by line Encryption fun with Crypt::CBC and Rijndael? File Ownership issues? (code)
in thread line by line Encryption fun with Crypt::CBC and Rijndael? File Ownership issues?
sub read_bytes { my ($fh, $to_read) = @_; $buf = ''; while ($to_read) { <b>my $bytes_read = read($FH_decrypted, $buf, length($buf));</b> die("$!\n") if !defined($bytes_read); die("Unexpected end of file\n") if !$bytes_read; $to_read -= $bytes_read; } return $buf; }
Should $FH_decrypted be $fh instead? Otherwise the value in $fh being passed to the function is seemingly never used.
Why is the value of $buf set to an empty string? Won't length($buf) be zero and therefore nothing would ever be read?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: line by line Encryption fun with Crypt::CBC and Rijndael? File Ownership issues? (code)
by ikegami (Patriarch) on Dec 06, 2007 at 18:39 UTC |