Skip to content
This repository
Browse code

[S32/IO] spec &spurt

  • Loading branch information...
commit 18e21331355f616ddbf034764bddc62207fcdffc 1 parent 1b5ae87
Carl Mäsak authored June 24, 2012

Showing 1 changed file with 39 additions and 0 deletions. Show diff stats Hide diff stats

  1. 39  S32-setting-library/IO.pod
39  S32-setting-library/IO.pod
Source Rendered
@@ -948,6 +948,45 @@ Slurps the entire file into a C<Str> (or C<Buf> if C<:bin>) regardless of contex
948 948
 
949 949
 In the case of a directory, it uses "\n" to separate entries.  
950 950
 
  951
+=item spurt
  952
+
  953
+    multi method spurt ($handle:
  954
+        Str   $contents,
  955
+        Str  :$enc = "Unicode",
  956
+        Bool :append = False,
  957
+    )
  958
+    multi method spurt ($handle:
  959
+        Buf   $contents,
  960
+        Bool :append = False,
  961
+    )
  962
+    multi spurt (IO $fh,
  963
+        Str   $contents,
  964
+        Str  :$enc = "Unicode",
  965
+        Bool :append = False,
  966
+    )
  967
+    multi spurt (IO $fh,
  968
+        Buf   $contents,
  969
+        Bool :append = False,
  970
+    )
  971
+    multi spurt (Str $filename,
  972
+        Str   $contents,
  973
+        Str  :$enc = "Unicode",
  974
+        Bool :append = False,
  975
+    )
  976
+    multi spurt (Str $filename,
  977
+        Buf   $contents,
  978
+        Bool :append = False,
  979
+    )
  980
+
  981
+Opens the file for writing, dumps the contents, and closes the file.
  982
+
  983
+This routine will C<fail> if the file exists, unless the C<:append> flag is
  984
+set, in which case it will instead add the given contents at the end of the
  985
+file.
  986
+
  987
+The routine will also C<fail> with the corresponding exception if there was any
  988
+other error in opening, writing, or closing.
  989
+
951 990
 =back
952 991
 
953 992
 =head3 Other things

0 notes on commit 18e2133

Please sign in to comment.
Something went wrong with that request. Please try again.