|
4 | 4 |
|
5 | 5 | =SUBTITLE Correctly use Perl 6 IO
|
6 | 6 |
|
| 7 | +=head1 The Basics |
| 8 | +
|
| 9 | +The vast majority of common IO work is done by the L<IO::Path> type. If you |
| 10 | +want to read from or write to a file in some form or shape, this is the class |
| 11 | +you want. It abstracts away the details of file handles (or "file descriptors") |
| 12 | +and so you mostly don't even have to think about them. |
| 13 | +
|
| 14 | +Behind the scenes, L<IO::Path> works with L<IO::Handle>; a class which you |
| 15 | +can use directly if you need a bit more control than what L<IO::Path> |
| 16 | +provides. When working with other processes, e.g. via L<Proc> or L<Proc::Async> |
| 17 | +types, you'll also be dealing with a I<subclass> of L<IO::Handle>: the |
| 18 | +L<IO::Pipe>. |
| 19 | +
|
| 20 | +Lastly, you have the L<IO::CatHandle>, as well as L<IO::Spec> and its |
| 21 | +subclasses, that you'll rarely, if ever, use directly. These classes give you |
| 22 | +advanced features, such as operating on multiple files as one handle, or |
| 23 | +low-level path manipulations. |
| 24 | +
|
| 25 | +Along with all these classes, Perl 6 provides several subroutines that provide |
| 26 | +let you indirectly work with these classes. These come in handy if you like |
| 27 | +functional programming style or in Perl 6 one liners. |
| 28 | +
|
| 29 | +While L<IO::Socket> and its subclasses also have to do with Input and Output, |
| 30 | +this guide does not cover them. |
| 31 | +
|
7 | 32 | =head1 The Wrong Way To Do Things
|
8 | 33 |
|
9 | 34 | This section describes how NOT to do Perl 6 IO.
|
|
0 commit comments