improve docs about limitations
David Golden
12 years ago
455 | 455 | return scalar @list; # $count will be 3 |
456 | 456 | }; |
457 | 457 | |
458 | Captures are normally done internally to an anonymous filehandle. To | |
458 | Captures are normally done to an anonymous temporary filehandle. To | |
459 | 459 | capture via a named file (e.g. to externally monitor a long-running capture), |
460 | 460 | provide custom filehandles as a trailing list of option pairs: |
461 | 461 | |
543 | 543 | == PerlIO layers |
544 | 544 | |
545 | 545 | Capture::Tiny does it's best to preserve PerlIO layers such as ':utf8' or |
546 | ':crlf' when capturing. Layers should be applied to STDOUT or STDERR ~before~ | |
547 | the call to {capture} or {tee}. This may not work for tied filehandles (see below). | |
546 | ':crlf' when capturing (only for Perl 5.8.1+) . Layers should be applied to | |
547 | STDOUT or STDERR ~before~ the call to {capture} or {tee}. This may not work | |
548 | for tied filehandles (see below). | |
548 | 549 | |
549 | 550 | == Modifying filehandles before capturing |
550 | 551 | |
602 | 603 | |
603 | 604 | *Tied input filehandle* |
604 | 605 | |
605 | Capture::Tiny attempts to preserve the semantics of tied STDIN, but this is not | |
606 | entirely stable or portable. For example: | |
607 | ||
608 | * Trying does not affect how external processes read data | |
609 | * Capturing or teeing with STDIN tied has been reported broken on Windows | |
606 | Capture::Tiny attempts to preserve the semantics of tied STDIN, but this | |
607 | requires Perl 5.8 and is not entirely predictable. External processes | |
608 | will not be able to read from such a handle. | |
610 | 609 | |
611 | 610 | Unless having STDIN tied is crucial, it may be safest to localize STDIN when |
612 | 611 | capturing: |
620 | 619 | |
621 | 620 | == No support for Perl 5.8.0 |
622 | 621 | |
623 | It's just too buggy when it comes to layers and UTF-8. | |
622 | It's just too buggy when it comes to layers and UTF-8. Perl 5.8.1 or later | |
623 | is recommended. | |
624 | ||
625 | == Limited support for Perl 5.6 | |
626 | ||
627 | Perl 5.6 predates PerlIO. UTF-8 data may not be captured correctly. | |
624 | 628 | |
625 | 629 | = ENVIRONMENT |
626 | 630 |