-
-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start to refactor IO::Handle encoding/bin mode.
This introduces a $!decoder attribute to IO::Handle. The presence of this is now used internally to determine if the handle is in binary mode. The $.encoding attribute is now a `Str` rather than a `str`, and will be the Str type object in the case where the file is in binary mode. It is now an error to pass both :bin and :enc to `open`. It is also an error to do char-level operations on a handle opened in binary mode (we do support mixed binary/Str operations, provided you know and understand the caveats, but then the file must be opened in normal/character mode in order to do that; this is because it needs extra bookkeeping that we can skip in binary mode). Some places set a default utf-8 encoding in their signatures, and so triggered the new sanity check when passing those along to `open`; they now just pass an undefined `$enc` in that case, which also concentrates the choice of that default better in IO::Handle. There remain further places that we might wish to remove `= 'utf-8'` also; these ones removed were those that caused breakage. Along the way, the setup of IO::Pipe objects in Proc was refactored to eliminate various bits of poking into IO::Handle internals from Proc, and this happily also reduced duplicated setup code.
- Loading branch information
1 parent
4052a7c
commit ba40946
Showing
5 changed files
with
86 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters