IO-Pipely-0.006/000755 000765 000024 00000000000 14155774733 013420 5ustar00trocstaff000000 000000 IO-Pipely-0.006/CHANGES000644 000765 000024 00000003061 14155774733 014413 0ustar00trocstaff000000 000000 ================================================== Changes from 2020-12-14 00:00:00 +0000 to present. ================================================== ------------------------------------------ version 0.006 at 2021-12-14 01:56:39 +0000 ------------------------------------------ Change: ae3e73a1a6dd1bd5421e16eb9724f67c6af8f766 Author: Rocco Caputo Date : 2021-12-13 20:41:21 +0000 Try to make `dzil release` more working. Change: b68a6402bc0744cf42d6b53263ab70809e1ed90c Author: Rocco Caputo Date : 2021-12-12 23:15:57 +0000 Fix a `dzil release` runtime complaint about base's required version. Change: 75e80bcf7007d8a28c4914e4af7cfef76db76125 Author: Rocco Caputo Date : 2021-12-12 22:29:53 +0000 Update copyright date. Change: 7cde30af6484ff4af88beb59df73712cdccbf770 Author: Rocco Caputo Date : 2021-12-12 22:23:09 +0000 Merge pull request #1 from zmughal/fix-socketpairly-docs Fix socketpairly() docs to match code. Change: 03c8d1aa97f579eadb8107fa40ce6b95538ccf14 Author: Zakariyya Mughal Date : 2021-12-12 21:57:17 +0000 Fix socketpairly() docs to match code Partially reverts 0eebdd0dee0fa90bf47ca4e8ae4e0216d66ac785 where the order of the list of handles returned by `socketpairly()` was changed only in the documentation, but not the code. ================================================ Plus 5 releases after 2020-12-14 00:00:00 +0000. ================================================ IO-Pipely-0.006/dist.ini000644 000765 000024 00000001425 14155774733 015066 0ustar00trocstaff000000 000000 name = IO-Pipely author = Rocco Caputo license = Perl_5 copyright_holder = Rocco Caputo [AutoPrereqs] [CheckPrereqsIndexed] [Prereqs::MatchInstalled::All] exclude = bytes exclude = constant exclude = lib exclude = perl exclude = strict exclude = vars exclude = warnings exclude = base [AutoMetaResources] bugtracker.rt = 1 license = http://dev.perl.org/licenses/ repository.github = user:rcaputo [Homepage] [ReadmeFromPod] [ReadmeMarkdownFromPod] [ReportVersions] [Repository] git_remote = gh [Git::Check] [Git::NextVersion] version_regexp = ^v(\d+\.\d+)$ [ChangelogFromGit] tag_regexp = v(\d+[_.]\d+) [Git::Tag] tag_format = v%v tag_message = Release %v. [@Classic] [MetaJSON] [TestRelease] [ConfirmRelease] [UploadToCPAN] IO-Pipely-0.006/lib/000755 000765 000024 00000000000 14155774733 014166 5ustar00trocstaff000000 000000 IO-Pipely-0.006/LICENSE000644 000765 000024 00000043650 14155774733 014435 0ustar00trocstaff000000 000000 This software is copyright (c) 2021 by Rocco Caputo. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2021 by Rocco Caputo. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2021 by Rocco Caputo. This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End IO-Pipely-0.006/Makefile.PL000644 000765 000024 00000002641 14155774733 015375 0ustar00trocstaff000000 000000 # This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.024. use strict; use warnings; use 5.004; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "Portably create pipe() or pipe-like handles, one way or another.", "AUTHOR" => "Rocco Caputo ", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0 }, "DISTNAME" => "IO-Pipely", "LICENSE" => "perl", "MIN_PERL_VERSION" => "5.004", "NAME" => "IO::Pipely", "PREREQ_PM" => { "Exporter" => "5.72", "Fcntl" => "1.13", "IO::Socket" => "1.38", "Symbol" => "1.08", "base" => 0, "strict" => 0, "warnings" => 0 }, "TEST_REQUIRES" => { "Carp" => "1.42", "Scalar::Util" => "1.46_02", "Test::More" => "1.302120" }, "VERSION" => "0.006", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "Carp" => "1.42", "Exporter" => "5.72", "Fcntl" => "1.13", "IO::Socket" => "1.38", "Scalar::Util" => "1.46_02", "Symbol" => "1.08", "Test::More" => "1.302120", "base" => 0, "strict" => 0, "warnings" => 0 ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); IO-Pipely-0.006/MANIFEST000644 000765 000024 00000000572 14155774733 014555 0ustar00trocstaff000000 000000 # This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.024. CHANGES LICENSE MANIFEST MANIFEST.SKIP META.json META.yml Makefile.PL README README.mkdn dist.ini lib/IO/Pipely.pm t/00-info-perl.t t/000-report-versions.t t/01-test-pod.t t/02-pod-no404s.t t/11-pipely-base.t t/12-pipely-oneway.t t/13-pipely-twoway.t t/author-pod-coverage.t t/author-pod-syntax.t IO-Pipely-0.006/MANIFEST.SKIP000644 000765 000024 00000000320 14155774733 015311 0ustar00trocstaff000000 000000 CVS \.\# \.bak$ \.cvsignore \.git \.gz$ \.orig$ \.patch$ \.ppd$ \.rej$ \.rej$ \.svn \.swo$ \.swp$ ^Makefile$ ^Makefile\.old$ ^\. ^_Inline ^_build ^blib/ ^comptest ^cover_db ^coverage\.report$ ^pm_to_blib$ ~$ IO-Pipely-0.006/META.json000644 000765 000024 00000003622 14155774733 015044 0ustar00trocstaff000000 000000 { "abstract" : "Portably create pipe() or pipe-like handles, one way or another.", "author" : [ "Rocco Caputo " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 6.024, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "IO-Pipely", "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "develop" : { "requires" : { "Pod::Coverage::TrustPod" : "0", "Test::Pod" : "1.41", "Test::Pod::Coverage" : "1.08" } }, "runtime" : { "requires" : { "Exporter" : "5.72", "Fcntl" : "1.13", "IO::Socket" : "1.38", "Symbol" : "1.08", "base" : "0", "strict" : "0", "warnings" : "0" } }, "test" : { "requires" : { "Carp" : "1.42", "Scalar::Util" : "1.46_02", "Test::More" : "1.302120", "perl" : "5.004" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "mailto" : "bug-IO-Pipely@rt.cpan.org", "web" : "https://rt.cpan.org/Public/Dist/Display.html?Name=IO-Pipely" }, "homepage" : "http://search.cpan.org/dist/IO-Pipely/", "license" : [ "http://dev.perl.org/licenses/" ], "repository" : { "type" : "git", "url" : "git://github.com/rcaputo/io-pipely.git", "web" : "https://github.com/rcaputo/io-pipely" } }, "version" : "0.006", "x_generated_by_perl" : "v5.26.1", "x_serialization_backend" : "Cpanel::JSON::XS version 3.0239", "x_spdx_expression" : "Artistic-1.0-Perl OR GPL-1.0-or-later" } IO-Pipely-0.006/META.yml000644 000765 000024 00000001752 14155774733 014676 0ustar00trocstaff000000 000000 --- abstract: 'Portably create pipe() or pipe-like handles, one way or another.' author: - 'Rocco Caputo ' build_requires: Carp: '1.42' Scalar::Util: 1.46_02 Test::More: '1.302120' perl: '5.004' configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 0 generated_by: 'Dist::Zilla version 6.024, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: IO-Pipely requires: Exporter: '5.72' Fcntl: '1.13' IO::Socket: '1.38' Symbol: '1.08' base: '0' strict: '0' warnings: '0' resources: bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=IO-Pipely homepage: http://search.cpan.org/dist/IO-Pipely/ license: http://dev.perl.org/licenses/ repository: git://github.com/rcaputo/io-pipely.git version: '0.006' x_generated_by_perl: v5.26.1 x_serialization_backend: 'YAML::Tiny version 1.70' x_spdx_expression: 'Artistic-1.0-Perl OR GPL-1.0-or-later' IO-Pipely-0.006/README000644 000765 000024 00000023041 14155774733 014300 0ustar00trocstaff000000 000000 NAME IO::Pipely - Portably create pipe() or pipe-like handles, one way or another. SYNOPSIS Please read DESCRIPTION for detailed semantics and caveats. use IO::Pipely qw(pipely socketpairly); # Create a one-directional pipe() or pipe-like thing # the best conduit type available. my ($read, $write) = pipely(); # Create a one-directional pipe-like thing using an # INET socket specifically. Other types are available. my ($read, $write) = pipely(type => 'inet'); # Create a bidirectional pipe-like thing using # the best conduit type available. my ( $side_a_read, $side_a_write, $side_b_read, $side_b_write, ) = socketpairly(); # Create a bidirectional pipe-like thing using an INET socket # specifically. my ( $side_a_read, $side_a_write, $side_b_read, $side_b_write, ) = socketpairly(type => 'inet'); DESCRIPTION Pipes are troublesome beasts because there are a few different, incompatible ways to create them. Not all platforms support all ways, and some platforms may have hidden difficulties like incomplete or buggy support. IO::Pipely provides a couple functions to portably create one- and two-way pipes and pipe-like socket pairs. It acknowledges and works around known platform issues so you don't have to. On the other hand, it doesn't work around unknown issues, so please report any problems early and often. IO::Pipely currently understands pipe(), UNIX-domain socketpair() and regular IPv4 localhost sockets. This covers every platform tested so far, but it's hardly complete. Please help support other mechanisms, such as INET-domain socketpair() and IPv6 localhost sockets. IO::Pipely will use different kinds of pipes or sockets depending on the operating system's capabilities and the number of directions requested. The autodetection may be overridden by specifying a particular pipe type. pipely pipely() creates a one-directional pipe() or socket. It's modeled after Perl's built-in pipe() function, but it creates and returns handles rather than opening ones given to it. On success, pipely() returns two file handles, the first to read from the pipe, and the second writes into the pipe. It returns nothing on failure. use IO::Pipely qw(pipely); my ($a_read, $b_write) = pipely(); die "pipely() failed: $!" unless $a_read; When given a choice, it will prefer to use leaner pipe() calls instead of socketpair() and socket(). pipely()'s choice can be forced using an optional named "type" parameter. See "PIPE TYPES" for the types that can be used. my ($a_read, $b_write) = pipely( type => 'pipe', ); On most systems, pipely() will prefer to open a pipe() first. It will fall back to a UNIX socketpair() or two localhost Internet sockets, in that order. On Windows (ActiveState and Strawberry Perl), pipely() prefers two localhost Internet sockets. It will fall back to socketpair() and pipe(), both of which will probably fail. Cygwin Perl prefers pipe() first, localhost Internet sockets, and then socketpair(). socketpair() has been known to have problems on Cygwin. MacPerl (MacOS 9 and earlier) has similar capaibilities to Windows. socketpairly socketpairly() creates a two-directional socket pair. It's modeled after Perl's built-in socketpair(), but it creates and returns handles rather than opening ones given to it. On success, socketpairly() returns four file handles, read and write for one end, and read and write for the other. On failure, it returns nothing. use IO::Pipely qw(socketpairly); my ($a_read, $a_write, $b_read, $b_write) = socketpairly(); die "socketpairly() failed: $!" unless $a_read; socketpairly() returns two extra "writer" handles. They exist for the fallback case where two pipe() calls are needed instead of one socket pair. The extra handles can be ignored whenever pipe() will never be used. For example: use IO::Pipely qw(socketpairly); my ($side_a, undef, $side_b, undef) = socketpairly( type => 'socketpair' ); die "socketpairly() failed: $!" unless $side_a; When given a choice, it will prefer bidirectional sockets instead of pipe() calls. socketpairly()'s choice can be forced using an optional named "type" parameter. See "PIPE TYPES" for the types that can be used. In this example, two unidirectional pipes wil be used instead of a more efficient pair of sockets: my ($a_read, $a_write, $b_read, $b_write) = socketpairly( type => 'pipe', ); On most systems, socketpairly() will try to open a UNIX socketpair() first. It will then fall back to a pair of localhost Internet sockets, and finally it will try a pair of pipe() calls. On Windows (ActiveState and Strawberry Perl), socketpairly() prefers a pair of localhost Internet sockets first. It will then fall back to a UNIX socketpair(), and finally a couple of pipe() calls. The fallback options will probably fail, but the code remains hopeful. Cygwin Perl prefers localhost Internet sockets first, followed by a pair of pipe() calls, and finally a UNIX socketpair(). Those who know may find this counter-intuitive, but it works around known issues in some versions of Cygwin socketpair(). MacPerl (MacOS 9 and earlier) has similar capaibilities to Windows. PIPE TYPES IO::Pipely currently supports three types of pipe and socket. Other types are possible, but these three cover all known uses so far. Please ask (or send patches) if additional types are needed. pipe Attempt to establish a one-way pipe using one pipe() filehandle pair (2 file descriptors), or a two-way pipe-like connection using two pipe() pairs (4 file descriptors). IO::Pipely prefers to use pipe() for one-way pipes and some form of socket pair for two-way pipelike things. socketpair Attempt to establish a one- or two-way pipelike connection using a single socketpair() call. This uses two file descriptors regardless whether the connection is one- or two-way. IO::Pipely prefers socketpair() for two-way connections, unless the current platform has known issues with the socketpair() call. Socket pairs are UNIX domain only for now. INET domain may be added if it improves compatibility on some platform, or if someone contributes the code. inet Attempt to establish a one- or two-way pipelike connection using localhost socket() calls. This uses two file descriptors regardless whether the connection is one- or two-way. Localhost INET domain sockets are a last resort for platforms that don't support something better. They are the least secure method of communication since tools like tcpdump and Wireshark can tap into them. On the other hand, this makes them easiest to debug. KNOWN ISSUES These are issues known to the developers at the time of this writing. Things change, so check back now and then. Cygwin CygWin seems to have a problem with socketpair() and exec(). When an exec'd process closes, any data on sockets created with socketpair() is not flushed. From irc.perl.org channel #poe: Sounds like a lapse in cygwin's exec implementation. It works ok under Unix-ish systems? yes, it works perfectly but, if we just use POE::Pipe::TwoWay->new("pipe") it always works fine on cygwin by the way, it looks like the reason is that POE::Pipe::OneWay works because it tries to make a pipe first instead of a socketpair this socketpair problem seems like a long-standing one with cygwin, according to searches on google, but never been fixed. MacOS 9 IO::Pipely supports MacOS 9 for historical reasons. It's unclear whether anyone still uses MacPerl, but the support is cheap since pipes and sockets there have many of the same caveats as they do on Windows. Symbol::gensym IO::Pipely uses Symbol::gensym() instead of autovivifying file handles. The main reasons against gensym() have been stylistic ones so far. Meanwhile, gensym() is compatible farther back than handle autovivification. Windows ActiveState and Strawberry Perl don't support pipe() or UNIX socketpair(). Localhost Internet sockets are used for everything there, including one-way pipes. For one-way pipes, the unused socket directions are shut down to avoid sending data the wrong way through them. Use socketpairly() instead. BUGS The functions implemented here die outright upon failure, requiring eval{} around their calls. The following conduit types are currently unsupported because nobody has needed them so far. Please submit a request (and/or a patch) if any of these is needed: UNIX socket() INET-domain socketpair() IPv4-specific localhost sockets IPv6-specific localhost sockets AUTHOR & COPYRIGHT IO::Pipely is copyright 2000-2021 by Rocco Caputo. All rights reserved. IO::Pipely is free software; you may redistribute it and/or modify it under the same terms as Perl itself. HISTORY IO::Pipely is a spin-off of the POE project's portable pipes. Earlier versions of the code have been tested and used in production systems for over a decade. IO-Pipely-0.006/README.mkdn000644 000765 000024 00000022143 14155774733 015232 0ustar00trocstaff000000 000000 # NAME IO::Pipely - Portably create pipe() or pipe-like handles, one way or another. # VERSION version 0.006 # SYNOPSIS Please read DESCRIPTION for detailed semantics and caveats. use IO::Pipely qw(pipely socketpairly); # Create a one-directional pipe() or pipe-like thing # the best conduit type available. my ($read, $write) = pipely(); # Create a one-directional pipe-like thing using an # INET socket specifically. Other types are available. my ($read, $write) = pipely(type => 'inet'); # Create a bidirectional pipe-like thing using # the best conduit type available. my ( $side_a_read, $side_a_write, $side_b_read, $side_b_write, ) = socketpairly(); # Create a bidirectional pipe-like thing using an INET socket # specifically. my ( $side_a_read, $side_a_write, $side_b_read, $side_b_write, ) = socketpairly(type => 'inet'); # DESCRIPTION Pipes are troublesome beasts because there are a few different, incompatible ways to create them. Not all platforms support all ways, and some platforms may have hidden difficulties like incomplete or buggy support. IO::Pipely provides a couple functions to portably create one- and two-way pipes and pipe-like socket pairs. It acknowledges and works around known platform issues so you don't have to. On the other hand, it doesn't work around unknown issues, so please report any problems early and often. IO::Pipely currently understands pipe(), UNIX-domain socketpair() and regular IPv4 localhost sockets. This covers every platform tested so far, but it's hardly complete. Please help support other mechanisms, such as INET-domain socketpair() and IPv6 localhost sockets. IO::Pipely will use different kinds of pipes or sockets depending on the operating system's capabilities and the number of directions requested. The autodetection may be overridden by specifying a particular pipe type. ## pipely pipely() creates a one-directional pipe() or socket. It's modeled after Perl's built-in pipe() function, but it creates and returns handles rather than opening ones given to it. On success, pipely() returns two file handles, the first to read from the pipe, and the second writes into the pipe. It returns nothing on failure. use IO::Pipely qw(pipely); my ($a_read, $b_write) = pipely(); die "pipely() failed: $!" unless $a_read; When given a choice, it will prefer to use leaner pipe() calls instead of socketpair() and socket(). pipely()'s choice can be forced using an optional named "type" parameter. See ["PIPE TYPES"](#pipe-types) for the types that can be used. my ($a_read, $b_write) = pipely( type => 'pipe', ); On most systems, pipely() will prefer to open a pipe() first. It will fall back to a UNIX socketpair() or two localhost Internet sockets, in that order. On Windows (ActiveState and Strawberry Perl), pipely() prefers two localhost Internet sockets. It will fall back to socketpair() and pipe(), both of which will probably fail. Cygwin Perl prefers pipe() first, localhost Internet sockets, and then socketpair(). socketpair() has been known to have problems on Cygwin. MacPerl (MacOS 9 and earlier) has similar capaibilities to Windows. ## socketpairly socketpairly() creates a two-directional socket pair. It's modeled after Perl's built-in socketpair(), but it creates and returns handles rather than opening ones given to it. On success, socketpairly() returns four file handles, read and write for one end, and read and write for the other. On failure, it returns nothing. use IO::Pipely qw(socketpairly); my ($a_read, $a_write, $b_read, $b_write) = socketpairly(); die "socketpairly() failed: $!" unless $a_read; socketpairly() returns two extra "writer" handles. They exist for the fallback case where two pipe() calls are needed instead of one socket pair. The extra handles can be ignored whenever pipe() will never be used. For example: use IO::Pipely qw(socketpairly); my ($side_a, undef, $side_b, undef) = socketpairly( type => 'socketpair' ); die "socketpairly() failed: $!" unless $side_a; When given a choice, it will prefer bidirectional sockets instead of pipe() calls. socketpairly()'s choice can be forced using an optional named "type" parameter. See ["PIPE TYPES"](#pipe-types) for the types that can be used. In this example, two unidirectional pipes wil be used instead of a more efficient pair of sockets: my ($a_read, $a_write, $b_read, $b_write) = socketpairly( type => 'pipe', ); On most systems, socketpairly() will try to open a UNIX socketpair() first. It will then fall back to a pair of localhost Internet sockets, and finally it will try a pair of pipe() calls. On Windows (ActiveState and Strawberry Perl), socketpairly() prefers a pair of localhost Internet sockets first. It will then fall back to a UNIX socketpair(), and finally a couple of pipe() calls. The fallback options will probably fail, but the code remains hopeful. Cygwin Perl prefers localhost Internet sockets first, followed by a pair of pipe() calls, and finally a UNIX socketpair(). Those who know may find this counter-intuitive, but it works around known issues in some versions of Cygwin socketpair(). MacPerl (MacOS 9 and earlier) has similar capaibilities to Windows. ## PIPE TYPES IO::Pipely currently supports three types of pipe and socket. Other types are possible, but these three cover all known uses so far. Please ask (or send patches) if additional types are needed. ### pipe Attempt to establish a one-way pipe using one pipe() filehandle pair (2 file descriptors), or a two-way pipe-like connection using two pipe() pairs (4 file descriptors). IO::Pipely prefers to use pipe() for one-way pipes and some form of socket pair for two-way pipelike things. ### socketpair Attempt to establish a one- or two-way pipelike connection using a single socketpair() call. This uses two file descriptors regardless whether the connection is one- or two-way. IO::Pipely prefers socketpair() for two-way connections, unless the current platform has known issues with the socketpair() call. Socket pairs are UNIX domain only for now. INET domain may be added if it improves compatibility on some platform, or if someone contributes the code. ### inet Attempt to establish a one- or two-way pipelike connection using localhost socket() calls. This uses two file descriptors regardless whether the connection is one- or two-way. Localhost INET domain sockets are a last resort for platforms that don't support something better. They are the least secure method of communication since tools like tcpdump and Wireshark can tap into them. On the other hand, this makes them easiest to debug. # KNOWN ISSUES These are issues known to the developers at the time of this writing. Things change, so check back now and then. ## Cygwin CygWin seems to have a problem with socketpair() and exec(). When an exec'd process closes, any data on sockets created with socketpair() is not flushed. From irc.perl.org channel #poe: Sounds like a lapse in cygwin's exec implementation. It works ok under Unix-ish systems? yes, it works perfectly but, if we just use POE::Pipe::TwoWay->new("pipe") it always works fine on cygwin by the way, it looks like the reason is that POE::Pipe::OneWay works because it tries to make a pipe first instead of a socketpair this socketpair problem seems like a long-standing one with cygwin, according to searches on google, but never been fixed. ## MacOS 9 IO::Pipely supports MacOS 9 for historical reasons. It's unclear whether anyone still uses MacPerl, but the support is cheap since pipes and sockets there have many of the same caveats as they do on Windows. ## Symbol::gensym IO::Pipely uses Symbol::gensym() instead of autovivifying file handles. The main reasons against gensym() have been stylistic ones so far. Meanwhile, gensym() is compatible farther back than handle autovivification. ## Windows ActiveState and Strawberry Perl don't support pipe() or UNIX socketpair(). Localhost Internet sockets are used for everything there, including one-way pipes. For one-way pipes, the unused socket directions are shut down to avoid sending data the wrong way through them. Use socketpairly() instead. # BUGS The functions implemented here die outright upon failure, requiring eval{} around their calls. The following conduit types are currently unsupported because nobody has needed them so far. Please submit a request (and/or a patch) if any of these is needed: UNIX socket() INET-domain socketpair() IPv4-specific localhost sockets IPv6-specific localhost sockets # AUTHOR & COPYRIGHT IO::Pipely is copyright 2000-2021 by Rocco Caputo. All rights reserved. IO::Pipely is free software; you may redistribute it and/or modify it under the same terms as Perl itself. # HISTORY IO::Pipely is a spin-off of the [POE](https://metacpan.org/pod/POE) project's portable pipes. Earlier versions of the code have been tested and used in production systems for over a decade. IO-Pipely-0.006/t/000755 000765 000024 00000000000 14155774733 013663 5ustar00trocstaff000000 000000 IO-Pipely-0.006/t/00-info-perl.t000644 000765 000024 00000000315 14155774733 016157 0ustar00trocstaff000000 000000 #!/usr/bin/perl # vim: ts=2 sw=2 filetype=perl expandtab use warnings; use strict; use Test::More tests => 1; # idea from Test::Harness, thanks! diag("Perl $], $^X on $^O"); pass("need a test to pass"); IO-Pipely-0.006/t/000-report-versions.t000644 000765 000024 00000031270 14155774733 017531 0ustar00trocstaff000000 000000 #!perl use warnings; use strict; use Test::More 0.94; # Include a cut-down version of YAML::Tiny so we don't introduce unnecessary # dependencies ourselves. package Local::YAML::Tiny; use strict; use Carp 'croak'; # UTF Support? sub HAVE_UTF8 () { $] >= 5.007003 } BEGIN { if ( HAVE_UTF8 ) { # The string eval helps hide this from Test::MinimumVersion eval "require utf8;"; die "Failed to load UTF-8 support" if $@; } # Class structure require 5.004; $YAML::Tiny::VERSION = '1.40'; # Error storage $YAML::Tiny::errstr = ''; } # Printable characters for escapes my %UNESCAPES = ( z => "\x00", a => "\x07", t => "\x09", n => "\x0a", v => "\x0b", f => "\x0c", r => "\x0d", e => "\x1b", '\\' => '\\', ); ##################################################################### # Implementation # Create an empty YAML::Tiny object sub new { my $class = shift; bless [ @_ ], $class; } # Create an object from a file sub read { my $class = ref $_[0] ? ref shift : shift; # Check the file my $file = shift or return $class->_error( 'You did not specify a file name' ); return $class->_error( "File '$file' does not exist" ) unless -e $file; return $class->_error( "'$file' is a directory, not a file" ) unless -f _; return $class->_error( "Insufficient permissions to read '$file'" ) unless -r _; # Slurp in the file local $/ = undef; local *CFG; unless ( open(CFG, $file) ) { return $class->_error("Failed to open file '$file': $!"); } my $contents = ; unless ( close(CFG) ) { return $class->_error("Failed to close file '$file': $!"); } $class->read_string( $contents ); } # Create an object from a string sub read_string { my $class = ref $_[0] ? ref shift : shift; my $self = bless [], $class; my $string = $_[0]; unless ( defined $string ) { return $self->_error("Did not provide a string to load"); } # Byte order marks # NOTE: Keeping this here to educate maintainers # my %BOM = ( # "\357\273\277" => 'UTF-8', # "\376\377" => 'UTF-16BE', # "\377\376" => 'UTF-16LE', # "\377\376\0\0" => 'UTF-32LE' # "\0\0\376\377" => 'UTF-32BE', # ); if ( $string =~ /^(?:\376\377|\377\376|\377\376\0\0|\0\0\376\377)/ ) { return $self->_error("Stream has a non UTF-8 BOM"); } else { # Strip UTF-8 bom if found, we'll just ignore it $string =~ s/^\357\273\277//; } # Try to decode as utf8 utf8::decode($string) if HAVE_UTF8; # Check for some special cases return $self unless length $string; unless ( $string =~ /[\012\015]+\z/ ) { return $self->_error("Stream does not end with newline character"); } # Split the file into lines my @lines = grep { ! /^\s*(?:\#.*)?\z/ } split /(?:\015{1,2}\012|\015|\012)/, $string; # Strip the initial YAML header @lines and $lines[0] =~ /^\%YAML[: ][\d\.]+.*\z/ and shift @lines; # A nibbling parser while ( @lines ) { # Do we have a document header? if ( $lines[0] =~ /^---\s*(?:(.+)\s*)?\z/ ) { # Handle scalar documents shift @lines; if ( defined $1 and $1 !~ /^(?:\#.+|\%YAML[: ][\d\.]+)\z/ ) { push @$self, $self->_read_scalar( "$1", [ undef ], \@lines ); next; } } if ( ! @lines or $lines[0] =~ /^(?:---|\.\.\.)/ ) { # A naked document push @$self, undef; while ( @lines and $lines[0] !~ /^---/ ) { shift @lines; } } elsif ( $lines[0] =~ /^\s*\-/ ) { # An array at the root my $document = [ ]; push @$self, $document; $self->_read_array( $document, [ 0 ], \@lines ); } elsif ( $lines[0] =~ /^(\s*)\S/ ) { # A hash at the root my $document = { }; push @$self, $document; $self->_read_hash( $document, [ length($1) ], \@lines ); } else { croak("YAML::Tiny failed to classify the line '$lines[0]'"); } } $self; } # Deparse a scalar string to the actual scalar sub _read_scalar { my ($self, $string, $indent, $lines) = @_; # Trim trailing whitespace $string =~ s/\s*\z//; # Explitic null/undef return undef if $string eq '~'; # Quotes if ( $string =~ /^\'(.*?)\'\z/ ) { return '' unless defined $1; $string = $1; $string =~ s/\'\'/\'/g; return $string; } if ( $string =~ /^\"((?:\\.|[^\"])*)\"\z/ ) { # Reusing the variable is a little ugly, # but avoids a new variable and a string copy. $string = $1; $string =~ s/\\"/"/g; $string =~ s/\\([never\\fartz]|x([0-9a-fA-F]{2}))/(length($1)>1)?pack("H2",$2):$UNESCAPES{$1}/gex; return $string; } # Special cases if ( $string =~ /^[\'\"!&]/ ) { croak("YAML::Tiny does not support a feature in line '$lines->[0]'"); } return {} if $string eq '{}'; return [] if $string eq '[]'; # Regular unquoted string return $string unless $string =~ /^[>|]/; # Error croak("YAML::Tiny failed to find multi-line scalar content") unless @$lines; # Check the indent depth $lines->[0] =~ /^(\s*)/; $indent->[-1] = length("$1"); if ( defined $indent->[-2] and $indent->[-1] <= $indent->[-2] ) { croak("YAML::Tiny found bad indenting in line '$lines->[0]'"); } # Pull the lines my @multiline = (); while ( @$lines ) { $lines->[0] =~ /^(\s*)/; last unless length($1) >= $indent->[-1]; push @multiline, substr(shift(@$lines), length($1)); } my $j = (substr($string, 0, 1) eq '>') ? ' ' : "\n"; my $t = (substr($string, 1, 1) eq '-') ? '' : "\n"; return join( $j, @multiline ) . $t; } # Parse an array sub _read_array { my ($self, $array, $indent, $lines) = @_; while ( @$lines ) { # Check for a new document if ( $lines->[0] =~ /^(?:---|\.\.\.)/ ) { while ( @$lines and $lines->[0] !~ /^---/ ) { shift @$lines; } return 1; } # Check the indent level $lines->[0] =~ /^(\s*)/; if ( length($1) < $indent->[-1] ) { return 1; } elsif ( length($1) > $indent->[-1] ) { croak("YAML::Tiny found bad indenting in line '$lines->[0]'"); } if ( $lines->[0] =~ /^(\s*\-\s+)[^\'\"]\S*\s*:(?:\s+|$)/ ) { # Inline nested hash my $indent2 = length("$1"); $lines->[0] =~ s/-/ /; push @$array, { }; $self->_read_hash( $array->[-1], [ @$indent, $indent2 ], $lines ); } elsif ( $lines->[0] =~ /^\s*\-(\s*)(.+?)\s*\z/ ) { # Array entry with a value shift @$lines; push @$array, $self->_read_scalar( "$2", [ @$indent, undef ], $lines ); } elsif ( $lines->[0] =~ /^\s*\-\s*\z/ ) { shift @$lines; unless ( @$lines ) { push @$array, undef; return 1; } if ( $lines->[0] =~ /^(\s*)\-/ ) { my $indent2 = length("$1"); if ( $indent->[-1] == $indent2 ) { # Null array entry push @$array, undef; } else { # Naked indenter push @$array, [ ]; $self->_read_array( $array->[-1], [ @$indent, $indent2 ], $lines ); } } elsif ( $lines->[0] =~ /^(\s*)\S/ ) { push @$array, { }; $self->_read_hash( $array->[-1], [ @$indent, length("$1") ], $lines ); } else { croak("YAML::Tiny failed to classify line '$lines->[0]'"); } } elsif ( defined $indent->[-2] and $indent->[-1] == $indent->[-2] ) { # This is probably a structure like the following... # --- # foo: # - list # bar: value # # ... so lets return and let the hash parser handle it return 1; } else { croak("YAML::Tiny failed to classify line '$lines->[0]'"); } } return 1; } # Parse an array sub _read_hash { my ($self, $hash, $indent, $lines) = @_; while ( @$lines ) { # Check for a new document if ( $lines->[0] =~ /^(?:---|\.\.\.)/ ) { while ( @$lines and $lines->[0] !~ /^---/ ) { shift @$lines; } return 1; } # Check the indent level $lines->[0] =~ /^(\s*)/; if ( length($1) < $indent->[-1] ) { return 1; } elsif ( length($1) > $indent->[-1] ) { croak("YAML::Tiny found bad indenting in line '$lines->[0]'"); } # Get the key unless ( $lines->[0] =~ s/^\s*([^\'\" ][^\n]*?)\s*:(\s+|$)// ) { if ( $lines->[0] =~ /^\s*[?\'\"]/ ) { croak("YAML::Tiny does not support a feature in line '$lines->[0]'"); } croak("YAML::Tiny failed to classify line '$lines->[0]'"); } my $key = $1; # Do we have a value? if ( length $lines->[0] ) { # Yes $hash->{$key} = $self->_read_scalar( shift(@$lines), [ @$indent, undef ], $lines ); } else { # An indent shift @$lines; unless ( @$lines ) { $hash->{$key} = undef; return 1; } if ( $lines->[0] =~ /^(\s*)-/ ) { $hash->{$key} = []; $self->_read_array( $hash->{$key}, [ @$indent, length($1) ], $lines ); } elsif ( $lines->[0] =~ /^(\s*)./ ) { my $indent2 = length("$1"); if ( $indent->[-1] >= $indent2 ) { # Null hash entry $hash->{$key} = undef; } else { $hash->{$key} = {}; $self->_read_hash( $hash->{$key}, [ @$indent, length($1) ], $lines ); } } } } return 1; } # Set error sub _error { $YAML::Tiny::errstr = $_[1]; undef; } # Retrieve error sub errstr { $YAML::Tiny::errstr; } ##################################################################### # Use Scalar::Util if possible, otherwise emulate it BEGIN { eval { require Scalar::Util; }; if ( $@ ) { # Failed to load Scalar::Util eval <<'END_PERL'; sub refaddr { my $pkg = ref($_[0]) or return undef; if (!!UNIVERSAL::can($_[0], 'can')) { bless $_[0], 'Scalar::Util::Fake'; } else { $pkg = undef; } "$_[0]" =~ /0x(\w+)/; my $i = do { local $^W; hex $1 }; bless $_[0], $pkg if defined $pkg; $i; } END_PERL } else { Scalar::Util->import('refaddr'); } } ##################################################################### # main test ##################################################################### package main; BEGIN { # Skip modules that either don't want to be loaded directly, such as # Module::Install, or that mess with the test count, such as the Test::* # modules listed here. # # Moose::Role conflicts if Moose is loaded as well, but Moose::Role is in # the Moose distribution and it's certain that someone who uses # Moose::Role also uses Moose somewhere, so if we disallow Moose::Role, # we'll still get the relevant version number. my %skip = map { $_ => 1 } qw( App::FatPacker Class::Accessor::Classy Devel::Cover Module::Install Moose::Role POE::Loop::Tk Template::Test Test::Kwalitee Test::Pod::Coverage Test::Portability::Files Test::YAML::Meta open ); my $Test = Test::Builder->new; $Test->plan(skip_all => "META.yml could not be found") unless -f 'META.yml' and -r _; my $meta = (Local::YAML::Tiny->read('META.yml'))->[0]; my %requires; for my $require_key (grep { /requires/ } keys %$meta) { my %h = %{ $meta->{$require_key} }; $requires{$_}++ for keys %h; } delete $requires{perl}; diag("Testing with Perl $], $^X"); for my $module (sort keys %requires) { if ($skip{$module}) { note "$module doesn't want to be loaded directly, skipping"; next; } local $SIG{__WARN__} = sub { note "$module: $_[0]" }; require_ok $module or BAIL_OUT("can't load $module"); my $version = $module->VERSION; $version = 'undefined' unless defined $version; diag(" $module version is $version"); } done_testing; } IO-Pipely-0.006/t/01-test-pod.t000644 000765 000024 00000000432 14155774733 016024 0ustar00trocstaff000000 000000 # vim: ts=2 sw=2 filetype=perl expandtab use Test::More; unless ( $ENV{RELEASE_TESTING} ) { plan skip_all => 'RELEASE_TESTING environment variable is not true.'; } eval "use Test::Pod 1.00"; plan skip_all => "Test::Pod 1.00 required for testing POD" if $@; all_pod_files_ok(); IO-Pipely-0.006/t/02-pod-no404s.t000644 000765 000024 00000001021 14155774733 016070 0ustar00trocstaff000000 000000 #!/usr/bin/perl -w # vim: ts=2 sw=2 filetype=perl expandtab # Tests POD for 404 links use strict; use Test::More; BEGIN { unless ($ENV{RUN_NETWORK_TESTS}) { plan skip_all => 'RUN_NETWORK_TESTS environment variable is not true.'; } unless ( $ENV{RELEASE_TESTING} ) { plan skip_all => 'RELEASE_TESTING environment variable is not true.'; } foreach my $req (qw(Test::Pod::No404s)) { eval "use $req"; if ($@) { plan skip_all => "$req is needed for these tests."; } } } all_pod_files_ok(); IO-Pipely-0.006/t/11-pipely-base.t000644 000765 000024 00000000217 14155774733 016501 0ustar00trocstaff000000 000000 #!/usr/bin/perl -w # vim: ts=2 sw=2 filetype=perl expandtab use strict; use Test::More; print "1..0 # SKIP not implemented yet\n"; exit 0; IO-Pipely-0.006/t/12-pipely-oneway.t000644 000765 000024 00000002607 14155774733 017077 0ustar00trocstaff000000 000000 #!/usr/bin/perl -w # vim: ts=2 sw=2 filetype=perl expandtab use warnings; use strict; use Test::More tests => 4; BEGIN { use_ok 'IO::Pipely', 'pipely' }; ### Test one-way pipe() pipe. SKIP: { my ($uni_read, $uni_write) = pipely(type => 'pipe'); skip "$^O does not support one-way pipe()", 1 unless defined $uni_read and defined $uni_write; print $uni_write "whee pipe\n"; my $uni_input = <$uni_read>; chomp $uni_input; ok($uni_input eq "whee pipe", "one-way pipe passed data unscathed"); } ### Test one-way socketpair() pipe. SKIP: { my ($uni_read, $uni_write) = pipely(type => 'socketpair'); skip "$^O does not support one-way socketpair()", 1 unless defined $uni_read and defined $uni_write; print $uni_write "whee socketpair\n"; my $uni_input = <$uni_read>; chomp $uni_input; ok( $uni_input eq 'whee socketpair', "one-way socketpair passed data unscathed" ); } ### Test one-way pair of inet sockets. SKIP: { unless ($ENV{RUN_NETWORK_TESTS}) { skip 'RUN_NETWORK_TESTS environment variable is not true.', 1; } my ($uni_read, $uni_write) = pipely(type => 'inet'); skip "$^O does not support one-way inet sockets.", 1 unless defined $uni_read and defined $uni_write; print $uni_write "whee inet\n"; my $uni_input = <$uni_read>; chomp $uni_input; ok( $uni_input eq 'whee inet', "one-way inet pipe passed data unscathed" ); } exit 0; IO-Pipely-0.006/t/13-pipely-twoway.t000644 000765 000024 00000003704 14155774733 017127 0ustar00trocstaff000000 000000 #!/usr/bin/perl -w # vim: ts=2 sw=2 filetype=perl expandtab use strict; use Test::More tests => 7; BEGIN { use_ok 'IO::Pipely', 'socketpairly' }; ### Test two-way pipe. SKIP: { my ($a_rd, $a_wr, $b_rd, $b_wr) = socketpairly(type => 'pipe'); skip "$^O does not support two-way pipe()", 2 unless defined $a_rd and defined $a_wr and defined $b_rd and defined $b_wr; print $a_wr "a wr inet\n"; my $b_input = <$b_rd>; chomp $b_input; ok( $b_input eq 'a wr inet', "two-way pipe passed data from a -> b unscathed" ); print $b_wr "b wr inet\n"; my $a_input = <$a_rd>; chomp $a_input; ok( $a_input eq 'b wr inet', "two-way pipe passed data from b -> a unscathed" ); } ### Test two-way socketpair. SKIP: { my ($a_rd, $a_wr, $b_rd, $b_wr) = socketpairly(type => 'socketpair'); skip "$^O does not support two-way socketpair", 2 unless defined $a_rd and defined $a_wr and defined $b_rd and defined $b_wr; print $a_wr "a wr inet\n"; my $b_input = <$b_rd>; chomp $b_input; ok( $b_input eq 'a wr inet', "two-way socketpair passed data from a -> b unscathed" ); print $b_wr "b wr inet\n"; my $a_input = <$a_rd>; chomp $a_input; ok( $a_input eq 'b wr inet', "two-way socketpair passed data from b -> a unscathed" ); } ### Test two-way inet sockets. SKIP: { unless ($ENV{RUN_NETWORK_TESTS}) { skip 'RUN_NETWORK_TESTS environment variable is not true.', 2; } my ($a_rd, $a_wr, $b_rd, $b_wr) = socketpairly(type => 'inet'); skip "$^O does not support two-way inet pipes", 2 unless defined $a_rd and defined $a_wr and defined $b_rd and defined $b_wr; print $a_wr "a wr inet\n"; my $b_input = <$b_rd>; chomp $b_input; ok( $b_input eq 'a wr inet', "two-way inet pipe passed data from a -> b unscathed" ); print $b_wr "b wr inet\n"; my $a_input = <$a_rd>; chomp $a_input; ok( $a_input eq 'b wr inet', "two-way inet pipe passed data from b -> a unscathed" ); } exit 0; IO-Pipely-0.006/t/author-pod-coverage.t000644 000765 000024 00000000536 14155774733 017727 0ustar00trocstaff000000 000000 #!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { print qq{1..0 # SKIP these tests are for testing by the author\n}; exit } } # This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests. use Test::Pod::Coverage 1.08; use Pod::Coverage::TrustPod; all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); IO-Pipely-0.006/t/author-pod-syntax.t000644 000765 000024 00000000454 14155774733 017461 0ustar00trocstaff000000 000000 #!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { print qq{1..0 # SKIP these tests are for testing by the author\n}; exit } } # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. use strict; use warnings; use Test::More; use Test::Pod 1.41; all_pod_files_ok(); IO-Pipely-0.006/lib/IO/000755 000765 000024 00000000000 14155774733 014475 5ustar00trocstaff000000 000000 IO-Pipely-0.006/lib/IO/Pipely.pm000644 000765 000024 00000045725 14155774733 016312 0ustar00trocstaff000000 000000 package IO::Pipely; $IO::Pipely::VERSION = '0.006'; use warnings; use strict; use Symbol qw(gensym); use IO::Socket qw( AF_UNIX PF_INET PF_UNSPEC SOCK_STREAM SOL_SOCKET SOMAXCONN SO_ERROR SO_REUSEADDR inet_aton pack_sockaddr_in unpack_sockaddr_in ); use Fcntl qw(F_GETFL F_SETFL O_NONBLOCK); use Errno qw(EINPROGRESS EWOULDBLOCK); our @EXPORT_OK = qw(pipely socketpairly); use base qw(Exporter); # The order of pipe primitives depends on the platform. # It's not always safe to assume that a function can be used if it's # present. my (@oneway_pipe_types, @twoway_pipe_types); if ($^O eq "MSWin32" or $^O eq "MacOS") { @oneway_pipe_types = qw(inet socketpair pipe); @twoway_pipe_types = qw(inet socketpair pipe); } elsif ($^O eq "cygwin") { @oneway_pipe_types = qw(pipe inet socketpair); @twoway_pipe_types = qw(inet pipe socketpair); } else { @oneway_pipe_types = qw(pipe socketpair inet); @twoway_pipe_types = qw(socketpair inet pipe); } # Provide dummy constants so things at least compile. These constants # aren't used if we're RUNNING_IN_HELL, but Perl needs to see them. BEGIN { # older perls than 5.10 needs a kick in the arse to AUTOLOAD the constant... eval "F_GETFL" if $] < 5.010; if ( ! defined &Fcntl::F_GETFL ) { if ( ! defined prototype "F_GETFL" ) { *F_GETFL = sub { 0 }; *F_SETFL = sub { 0 }; } else { *F_GETFL = sub () { 0 }; *F_SETFL = sub () { 0 }; } } } # Make a socket. This is a homebrew socketpair() for systems that # don't support it. The things I must do to make Windows happy. sub _make_socket { ### Server side. my $acceptor = gensym(); my $accepted = gensym(); my $tcp = getprotobyname('tcp') or die "getprotobyname: $!"; socket( $acceptor, PF_INET, SOCK_STREAM, $tcp ) or die "socket: $!"; setsockopt( $acceptor, SOL_SOCKET, SO_REUSEADDR, 1) or die "reuse: $!"; my $server_addr = inet_aton('127.0.0.1') or die "inet_aton: $!"; $server_addr = pack_sockaddr_in(0, $server_addr) or die "sockaddr_in: $!"; bind( $acceptor, $server_addr ) or die "bind: $!"; $acceptor->blocking(0); $server_addr = getsockname($acceptor); listen( $acceptor, SOMAXCONN ) or die "listen: $!"; ### Client side. my $connector = gensym(); socket( $connector, PF_INET, SOCK_STREAM, $tcp ) or die "socket: $!"; $connector->blocking(0); unless (connect( $connector, $server_addr )) { die "connect: $!" if $! and ($! != EINPROGRESS) and ($! != EWOULDBLOCK); } my $connector_address = getsockname($connector); my ($connector_port, $connector_addr) = unpack_sockaddr_in($connector_address); ### Loop around 'til it's all done. I thought I was done writing ### select loops. Damnit. my $in_read = ''; my $in_write = ''; vec( $in_read, fileno($acceptor), 1 ) = 1; vec( $in_write, fileno($connector), 1 ) = 1; my $done = 0; while ($done != 0x11) { my $hits = select( my $out_read = $in_read, my $out_write = $in_write, undef, 5 ); unless ($hits) { next if ($! and ($! == EINPROGRESS) or ($! == EWOULDBLOCK)); die "select: $!" unless $hits; } # Accept happened. if (vec($out_read, fileno($acceptor), 1)) { my $peer = accept($accepted, $acceptor); my ($peer_port, $peer_addr) = unpack_sockaddr_in($peer); if ( $peer_port == $connector_port and $peer_addr eq $connector_addr ) { vec($in_read, fileno($acceptor), 1) = 0; $done |= 0x10; } } # Connect happened. if (vec($out_write, fileno($connector), 1)) { $! = unpack('i', getsockopt($connector, SOL_SOCKET, SO_ERROR)); die "connect: $!" if $!; vec($in_write, fileno($connector), 1) = 0; $done |= 0x01; } } # Turn blocking back on, damnit. $accepted->blocking(1); $connector->blocking(1); return ($accepted, $connector); } sub pipely { my %arg = @_; my $conduit_type = delete($arg{type}); my $debug = delete($arg{debug}) || 0; # Generate symbols to be used as filehandles for the pipe's ends. # # Filehandle autovivification isn't used for portability with older # versions of Perl. my ($a_read, $b_write) = (gensym(), gensym()); # Try the specified conduit type only. No fallback. if (defined $conduit_type) { return ($a_read, $b_write) if _try_oneway_type( $conduit_type, $debug, \$a_read, \$b_write ); } # Otherwise try all available conduit types until one works. # Conduit types that fail are discarded for speed. while (my $try_type = $oneway_pipe_types[0]) { return ($a_read, $b_write) if _try_oneway_type( $try_type, $debug, \$a_read, \$b_write ); shift @oneway_pipe_types; } # There's no conduit type left. Bummer! $debug and warn "nothing worked"; return; } sub socketpairly { my %arg = @_; my $conduit_type = delete($arg{type}); my $debug = delete($arg{debug}) || 0; # Generate symbols to be used as filehandles for the pipe's ends. # # Filehandle autovivification isn't used for portability with older # versions of Perl. my ($a_read, $a_write) = (gensym(), gensym()); my ($b_read, $b_write) = (gensym(), gensym()); if (defined $conduit_type) { return ($a_read, $a_write, $b_read, $b_write) if _try_twoway_type( $conduit_type, $debug, \$a_read, \$a_write, \$b_read, \$b_write ); } while (my $try_type = $twoway_pipe_types[0]) { return ($a_read, $a_write, $b_read, $b_write) if _try_twoway_type( $try_type, $debug, \$a_read, \$a_write, \$b_read, \$b_write ); shift @oneway_pipe_types; } # There's no conduit type left. Bummer! $debug and warn "nothing worked"; return; } # Try a pipe by type. sub _try_oneway_type { my ($type, $debug, $a_read, $b_write) = @_; # Try a pipe(). if ($type eq "pipe") { eval { pipe($$a_read, $$b_write) or die "pipe failed: $!"; }; # Pipe failed. if (length $@) { warn "pipe failed: $@" if $debug; return; } $debug and do { warn "using a pipe"; warn "ar($$a_read) bw($$b_write)\n"; }; # Turn off buffering. POE::Kernel does this for us, but # someone might want to use the pipe class elsewhere. select((select($$b_write), $| = 1)[0]); return 1; } # Try a UNIX-domain socketpair. if ($type eq "socketpair") { eval { socketpair($$a_read, $$b_write, AF_UNIX, SOCK_STREAM, PF_UNSPEC) or die "socketpair failed: $!"; }; if (length $@) { warn "socketpair failed: $@" if $debug; return; } $debug and do { warn "using a UNIX domain socketpair"; warn "ar($$a_read) bw($$b_write)\n"; }; # It's one-way, so shut down the unused directions. shutdown($$a_read, 1); shutdown($$b_write, 0); # Turn off buffering. POE::Kernel does this for us, but someone # might want to use the pipe class elsewhere. select((select($$b_write), $| = 1)[0]); return 1; } # Try a pair of plain INET sockets. if ($type eq "inet") { eval { ($$a_read, $$b_write) = _make_socket(); }; if (length $@) { warn "make_socket failed: $@" if $debug; return; } $debug and do { warn "using a plain INET socket"; warn "ar($$a_read) bw($$b_write)\n"; }; # It's one-way, so shut down the unused directions. shutdown($$a_read, 1); shutdown($$b_write, 0); # Turn off buffering. POE::Kernel does this for us, but someone # might want to use the pipe class elsewhere. select((select($$b_write), $| = 1)[0]); return 1; } # There's nothing left to try. $debug and warn "unknown pipely() socket type ``$type''"; return; } # Try a pipe by type. sub _try_twoway_type { my ($type, $debug, $a_read, $a_write, $b_read, $b_write) = @_; # Try a socketpair(). if ($type eq "socketpair") { eval { socketpair($$a_read, $$b_read, AF_UNIX, SOCK_STREAM, PF_UNSPEC) or die "socketpair 1 failed: $!"; }; # Socketpair failed. if (length $@) { warn "socketpair failed: $@" if $debug; return; } $debug and do { warn "using UNIX domain socketpairs"; warn "ar($$a_read) aw($$a_write) br($$b_read) bw($$b_write)\n"; }; # It's two-way, so each reader is also a writer. $$a_write = $$a_read; $$b_write = $$b_read; # Turn off buffering. POE::Kernel does this for us, but someone # might want to use the pipe class elsewhere. select((select($$a_write), $| = 1)[0]); select((select($$b_write), $| = 1)[0]); return 1; } # Try a couple pipe() calls. if ($type eq "pipe") { eval { pipe($$a_read, $$b_write) or die "pipe 1 failed: $!"; pipe($$b_read, $$a_write) or die "pipe 2 failed: $!"; }; # Pipe failed. if (length $@) { warn "pipe failed: $@" if $debug; return; } $debug and do { warn "using a pipe"; warn "ar($$a_read) aw($$a_write) br($$b_read) bw($$b_write)\n"; }; # Turn off buffering. POE::Kernel does this for us, but someone # might want to use the pipe class elsewhere. select((select($$a_write), $| = 1)[0]); select((select($$b_write), $| = 1)[0]); return 1; } # Try a pair of plain INET sockets. if ($type eq "inet") { eval { ($$a_read, $$b_read) = _make_socket(); }; # Sockets failed. if (length $@) { warn "make_socket failed: $@" if $debug; return; } $debug and do { warn "using a plain INET socket"; warn "ar($$a_read) aw($$a_write) br($$b_read) bw($$b_write)\n"; }; $$a_write = $$a_read; $$b_write = $$b_read; # Turn off buffering. POE::Kernel does this for us, but someone # might want to use the pipe class elsewhere. select((select($$a_write), $| = 1)[0]); select((select($$b_write), $| = 1)[0]); return 1; } $debug and warn "unknown pipely(2) socket type ``$type''"; return; } 1; __END__ =head1 NAME IO::Pipely - Portably create pipe() or pipe-like handles, one way or another. =head1 VERSION version 0.006 =head1 SYNOPSIS Please read DESCRIPTION for detailed semantics and caveats. use IO::Pipely qw(pipely socketpairly); # Create a one-directional pipe() or pipe-like thing # the best conduit type available. my ($read, $write) = pipely(); # Create a one-directional pipe-like thing using an # INET socket specifically. Other types are available. my ($read, $write) = pipely(type => 'inet'); # Create a bidirectional pipe-like thing using # the best conduit type available. my ( $side_a_read, $side_a_write, $side_b_read, $side_b_write, ) = socketpairly(); # Create a bidirectional pipe-like thing using an INET socket # specifically. my ( $side_a_read, $side_a_write, $side_b_read, $side_b_write, ) = socketpairly(type => 'inet'); =head1 DESCRIPTION Pipes are troublesome beasts because there are a few different, incompatible ways to create them. Not all platforms support all ways, and some platforms may have hidden difficulties like incomplete or buggy support. IO::Pipely provides a couple functions to portably create one- and two-way pipes and pipe-like socket pairs. It acknowledges and works around known platform issues so you don't have to. On the other hand, it doesn't work around unknown issues, so please report any problems early and often. IO::Pipely currently understands pipe(), UNIX-domain socketpair() and regular IPv4 localhost sockets. This covers every platform tested so far, but it's hardly complete. Please help support other mechanisms, such as INET-domain socketpair() and IPv6 localhost sockets. IO::Pipely will use different kinds of pipes or sockets depending on the operating system's capabilities and the number of directions requested. The autodetection may be overridden by specifying a particular pipe type. =head2 pipely pipely() creates a one-directional pipe() or socket. It's modeled after Perl's built-in pipe() function, but it creates and returns handles rather than opening ones given to it. On success, pipely() returns two file handles, the first to read from the pipe, and the second writes into the pipe. It returns nothing on failure. use IO::Pipely qw(pipely); my ($a_read, $b_write) = pipely(); die "pipely() failed: $!" unless $a_read; When given a choice, it will prefer to use leaner pipe() calls instead of socketpair() and socket(). pipely()'s choice can be forced using an optional named "type" parameter. See L for the types that can be used. my ($a_read, $b_write) = pipely( type => 'pipe', ); On most systems, pipely() will prefer to open a pipe() first. It will fall back to a UNIX socketpair() or two localhost Internet sockets, in that order. On Windows (ActiveState and Strawberry Perl), pipely() prefers two localhost Internet sockets. It will fall back to socketpair() and pipe(), both of which will probably fail. Cygwin Perl prefers pipe() first, localhost Internet sockets, and then socketpair(). socketpair() has been known to have problems on Cygwin. MacPerl (MacOS 9 and earlier) has similar capaibilities to Windows. =head2 socketpairly socketpairly() creates a two-directional socket pair. It's modeled after Perl's built-in socketpair(), but it creates and returns handles rather than opening ones given to it. On success, socketpairly() returns four file handles, read and write for one end, and read and write for the other. On failure, it returns nothing. use IO::Pipely qw(socketpairly); my ($a_read, $a_write, $b_read, $b_write) = socketpairly(); die "socketpairly() failed: $!" unless $a_read; socketpairly() returns two extra "writer" handles. They exist for the fallback case where two pipe() calls are needed instead of one socket pair. The extra handles can be ignored whenever pipe() will never be used. For example: use IO::Pipely qw(socketpairly); my ($side_a, undef, $side_b, undef) = socketpairly( type => 'socketpair' ); die "socketpairly() failed: $!" unless $side_a; When given a choice, it will prefer bidirectional sockets instead of pipe() calls. socketpairly()'s choice can be forced using an optional named "type" parameter. See L for the types that can be used. In this example, two unidirectional pipes wil be used instead of a more efficient pair of sockets: my ($a_read, $a_write, $b_read, $b_write) = socketpairly( type => 'pipe', ); On most systems, socketpairly() will try to open a UNIX socketpair() first. It will then fall back to a pair of localhost Internet sockets, and finally it will try a pair of pipe() calls. On Windows (ActiveState and Strawberry Perl), socketpairly() prefers a pair of localhost Internet sockets first. It will then fall back to a UNIX socketpair(), and finally a couple of pipe() calls. The fallback options will probably fail, but the code remains hopeful. Cygwin Perl prefers localhost Internet sockets first, followed by a pair of pipe() calls, and finally a UNIX socketpair(). Those who know may find this counter-intuitive, but it works around known issues in some versions of Cygwin socketpair(). MacPerl (MacOS 9 and earlier) has similar capaibilities to Windows. =head2 PIPE TYPES IO::Pipely currently supports three types of pipe and socket. Other types are possible, but these three cover all known uses so far. Please ask (or send patches) if additional types are needed. =head3 pipe Attempt to establish a one-way pipe using one pipe() filehandle pair (2 file descriptors), or a two-way pipe-like connection using two pipe() pairs (4 file descriptors). IO::Pipely prefers to use pipe() for one-way pipes and some form of socket pair for two-way pipelike things. =head3 socketpair Attempt to establish a one- or two-way pipelike connection using a single socketpair() call. This uses two file descriptors regardless whether the connection is one- or two-way. IO::Pipely prefers socketpair() for two-way connections, unless the current platform has known issues with the socketpair() call. Socket pairs are UNIX domain only for now. INET domain may be added if it improves compatibility on some platform, or if someone contributes the code. =head3 inet Attempt to establish a one- or two-way pipelike connection using localhost socket() calls. This uses two file descriptors regardless whether the connection is one- or two-way. Localhost INET domain sockets are a last resort for platforms that don't support something better. They are the least secure method of communication since tools like tcpdump and Wireshark can tap into them. On the other hand, this makes them easiest to debug. =head1 KNOWN ISSUES These are issues known to the developers at the time of this writing. Things change, so check back now and then. =head2 Cygwin CygWin seems to have a problem with socketpair() and exec(). When an exec'd process closes, any data on sockets created with socketpair() is not flushed. From irc.perl.org channel #poe: Sounds like a lapse in cygwin's exec implementation. It works ok under Unix-ish systems? yes, it works perfectly but, if we just use POE::Pipe::TwoWay->new("pipe") it always works fine on cygwin by the way, it looks like the reason is that POE::Pipe::OneWay works because it tries to make a pipe first instead of a socketpair this socketpair problem seems like a long-standing one with cygwin, according to searches on google, but never been fixed. =head2 MacOS 9 IO::Pipely supports MacOS 9 for historical reasons. It's unclear whether anyone still uses MacPerl, but the support is cheap since pipes and sockets there have many of the same caveats as they do on Windows. =head2 Symbol::gensym IO::Pipely uses Symbol::gensym() instead of autovivifying file handles. The main reasons against gensym() have been stylistic ones so far. Meanwhile, gensym() is compatible farther back than handle autovivification. =head2 Windows ActiveState and Strawberry Perl don't support pipe() or UNIX socketpair(). Localhost Internet sockets are used for everything there, including one-way pipes. For one-way pipes, the unused socket directions are shut down to avoid sending data the wrong way through them. Use socketpairly() instead. =head1 BUGS The functions implemented here die outright upon failure, requiring eval{} around their calls. The following conduit types are currently unsupported because nobody has needed them so far. Please submit a request (and/or a patch) if any of these is needed: UNIX socket() INET-domain socketpair() IPv4-specific localhost sockets IPv6-specific localhost sockets =head1 AUTHOR & COPYRIGHT IO::Pipely is copyright 2000-2021 by Rocco Caputo. All rights reserved. IO::Pipely is free software; you may redistribute it and/or modify it under the same terms as Perl itself. =head1 HISTORY IO::Pipely is a spin-off of the L project's portable pipes. Earlier versions of the code have been tested and used in production systems for over a decade. =cut # rocco // vim: ts=2 sw=2 expandtab