Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[S32/IO] spec &spurt

  • Loading branch information...
commit 18e21331355f616ddbf034764bddc62207fcdffc 1 parent 1b5ae87
Carl Mäsak masak authored
Showing with 39 additions and 0 deletions.
  1. +39 −0 S32-setting-library/IO.pod
39 S32-setting-library/IO.pod
View
@@ -948,6 +948,45 @@ Slurps the entire file into a C<Str> (or C<Buf> if C<:bin>) regardless of contex
In the case of a directory, it uses "\n" to separate entries.
+=item spurt
+
+ multi method spurt ($handle:
+ Str $contents,
+ Str :$enc = "Unicode",
+ Bool :append = False,
+ )
+ multi method spurt ($handle:
+ Buf $contents,
+ Bool :append = False,
+ )
+ multi spurt (IO $fh,
+ Str $contents,
+ Str :$enc = "Unicode",
+ Bool :append = False,
+ )
+ multi spurt (IO $fh,
+ Buf $contents,
+ Bool :append = False,
+ )
+ multi spurt (Str $filename,
+ Str $contents,
+ Str :$enc = "Unicode",
+ Bool :append = False,
+ )
+ multi spurt (Str $filename,
+ Buf $contents,
+ Bool :append = False,
+ )
+
+Opens the file for writing, dumps the contents, and closes the file.
+
+This routine will C<fail> if the file exists, unless the C<:append> flag is
+set, in which case it will instead add the given contents at the end of the
+file.
+
+The routine will also C<fail> with the corresponding exception if there was any
+other error in opening, writing, or closing.
+
=back
=head3 Other things
Please sign in to comment.
Something went wrong with that request. Please try again.