Changeset 15220 for docs/Perl6/Spec

Show
Ignore:
Timestamp:
02/09/07 00:56:00 (22 months ago)
Author:
lwall
Message:

IO.pod: translated some p5 docs for print.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • docs/Perl6/Spec/IO.pod

    r15167 r15220  
    1212 Contributions: Mark Stosberg <mark@summersault.com> 
    1313 Date:          12 Sep 2006 
    14  Last Modified: 25 Sep 2006 
    15  Version:       1 
     14 Last Modified: 8 Feb 2007 
     15 Version:       16 
    1616 
    1717This is a draft document. Many of these functions will work as in Perl 5, 
     
    3838  $file.:X 
    3939  $file ~~ :X 
    40   $file.TEST(:X) 
    4140 
    4241A file test, where X is one of the letters listed below.  This unary 
     
    162161=item closedir 
    163162 
    164  closedir (IO::Dir $dir)   
     163 closedir $dir 
    165164 $dir.closedir 
    166165 
     
    212211=item readdir 
    213212 
    214  readdir (IO::Dir $dir)   
     213 readdir $dir 
    215214 $dir.readdir 
    216215 
     
    230229=item rewinddir 
    231230 
    232  rewinddir (IO::Dir $dir)   
     231 rewinddir $dir 
    233232 $dir.rewinddir 
    234233 
     
    274273systems.  Use C<rmdir> instead. 
    275274 
    276 If LIST is omitted, uses C<$_>. 
     275It is an error to use bare C<unlink> without arguments. 
    277276 
    278277=item utime 
     
    285284 
    286285=item getc FILEHANDLE 
     286 
     287=item FILEHANDLE.getc 
    287288 
    288289Returns the next character from the input file attached to FILEHANDLE, 
     
    290291the latter case C<$!> is set).  
    291292 
    292 =item print FILEHANDLE LIST 
    293 X<print> 
     293=item print FILEHANDLE: LIST 
     294 
     295=item FILEHANDLE.print(LIST) 
     296 
     297=item FILEHANDLE.print: LIST 
    294298 
    295299=item print LIST 
    296300 
    297 =item print 
     301=item .print 
     302 
    298303 
    299304Prints a string or a list of strings.  Returns true if successful. 
    300 FILEHANDLE may be a scalar variable name, in which case the variable 
    301 contains the name of or a reference to the filehandle, thus introducing 
    302 one level of indirection.  (NOTE: If FILEHANDLE is a variable and 
    303 the next token is a term, it may be misinterpreted as an operator 
    304 unless you interpose a C<+> or put parentheses around the arguments.) 
    305 If FILEHANDLE is omitted, prints by default to standard output (or 
    306 to the last selected output channel--see L</select>).  If LIST is 
    307 also omitted, prints C<$_> to the currently selected output channel. 
    308 To set the default output channel to something other than STDOUT 
    309 use the select operation.   
    310  
    311 =begin comment 
    312  
    313 [ I don't know what's become of $, and $\. -markstos ]  
    314  
    315 The current value of C<$,> (if any) is 
    316 printed between each LIST item.  The current value of C<$\> (if 
    317 any) is printed after the entire LIST has been printed.  
    318  
    319 =end comment 
    320  
    321 Because print takes a LIST, anything in the LIST is evaluated in list context, 
    322 and any subroutine that you call will have one or more of its expressions 
    323 evaluated in list context.  Also be careful not to follow the print keyword 
    324 with a left parenthesis unless you want the corresponding right parenthesis to 
    325 terminate the arguments to the print--interpose a C<+> or put parentheses 
    326 around all the arguments. 
    327  
    328 Note that if you're storing FILEHANDLEs in an array, or if you're using 
    329 any other expression more complex than a scalar variable to retrieve it, 
    330 you will have to use a block returning the filehandle value instead: 
    331  
    332     print { @files[$i] } "stuff\n"; 
    333     print { $OK ?? STDOUT !! STDERR } "stuff\n"; 
     305FILEHANDLE, if supplied, must be a filehandle object.  Indirect objects 
     306in Perl 6 must always be followed by a colon, and any indirect object 
     307more complicated than a variable should be put into parentheses. 
     308 
     309If FILEHANDLE is omitted, prints to standard output. 
     310The form with leading dot prints C<$_> to standard output. 
     311(It is a compiler error to use a bare C<print> without arguments.) 
     312 
     313There is are no variables corresponding to Perl 5's C<$,> and 
     314C<$\> variables.  Use C<join> to interpose separators; use filehandle 
     315properties to change line endings. 
    334316 
    335317=item printf 
     
    402384 
    403385Slurps the entire file into a Str or Buf regardless of context. 
    404 (See also C<lines>.)  Whether a Str or Buf is returneded depends on 
     386(See also C<lines>.)  Whether a Str or Buf is returned depends on 
    405387the options. 
    406388