Please sign in to comment.
Support more modes in IO::Handle.open
Introduces the following named parameters: :mode<ro> :mode<wo> :mode<rw> :mode<pipe> :create :append :truncate :exclusive In addition to :p, :r, :w, :a and the (previously broken) :rw, there's now also :update, :x, :rx and :ra, with following expansions: :p --> :mode<pipe> :r --> :mode<ro> :w --> :mode<wo> :create :truncate :x --> :mode<wo> :create :exclusive :a --> :mode<wo> :create :append :update --> :mode<rw> :rw --> :mode<rw> :create :rx --> :mode<rw> :create :exclusive :ra --> :mode<rw> :create :append The combination of :r with one of the flags :w, :x or :a tries to DWIM, ie :r :w --> :rw :r :x --> :rx :r :a --> :ra In particular, :r :w does NOT truncate. C11 fopen() and Perl 5 &open modes correspond to the following Perl 6 modes: C11 P5 P6 r < :r w > :w wx :x a >> :a r+ +< :update w+ +> :rw :truncate w+x :rx a+ +>> :ra Neither Perl 5 nor C11 come with an equivalent to :rw which (in contrast to update) does not fail if the file had to be created. On Parrot and the JVM, none of the new modes are supported. In addition, using :rw on these backends will now throw an error instead of silently gettind adjusted to :w (cf #125170).
- Loading branch information...