IO-Interactive-1.022/000755 000765 000024 00000000000 12762730714 014547 5ustar00brianstaff000000 000000 IO-Interactive-1.022/Changes000644 000765 000024 00000003272 12762730712 016044 0ustar00brianstaff000000 000000 Revision history for Perl module IO::Interactive 1.022 2016-09-04T05:31:39Z * Stable release with some performance enhancements 1.021_02 - 2016-08-30T08:09:35Z * Lazy load Carp (Todd Rinaldo) 1.021 = 2016-01-27T20:29:17Z * Freshen the distro a bit * Somehow CPAN still has 0.0.6, so no one has David Muey's enhancements 1.01 - 2011-11-18 * Decrease memory use a bit ***: 1. lazy load Carp.pm only if we're about to croak() 2. Remove use of version.pm since a decimal will do (made it 1.01 per discussion) - moots rt 50120 3. Remove the need for Scalar::Util === Baseline RSS 1204, Orig RSS 2464 (+1260), New RSS 2244 (+1040) Technically -220 not a *huge* gain, but the ::Tiny version I'd worked up before this patch had an RSS of 1332 (+128). I need to look into that and see if anything else could be done here. 0.0.6 - 2009-01-14 0.0.5 - 2009-01-14 * Happy 2009! There aren't any code changes, but I needed to make the version in the Pod match the code version. 0.0.4 - 2008-08-31 * Fixes include: * #24823: is_interactive() and command line arguments * #38660: "null" filehandle is a memory leak * #20689: IO::Interactive leaks temp files 0.03_01 - 2008-08-24 * Cleaning up old tickets: * #20689 Now that we don't use a scalar filehandle, no extra temp files under 5.6.2 * #24823 Applied Schwern's patch to ignore command line arguments * #38660 Fix memory link (same fix for #20689), not printing to a scalar * Maintainer is now brian d foy 0.0.3 - 2006-02-17 * Fixed is_interactive to default to currently selected filehandle, rather than to *STDOUT. 0.0.2 - 2005-05-22 * added dependency on version.pm 0.0.1 - 2005-03-17 * Initial release. IO-Interactive-1.022/examples/000755 000765 000024 00000000000 12762730714 016365 5ustar00brianstaff000000 000000 IO-Interactive-1.022/INSTALL.SKIP000644 000765 000024 00000000156 12762730712 016345 0ustar00brianstaff000000 000000 README\.pod README.* # things that might be in local directories after fooling # around with them \.DS_Store IO-Interactive-1.022/lib/000755 000765 000024 00000000000 12762730714 015315 5ustar00brianstaff000000 000000 IO-Interactive-1.022/LICENSE000644 000765 000024 00000017406 12762730712 015562 0ustar00brianstaff000000 000000 The IO::Interactive module is licensed under the same terms as perl itself, under the Artistic License 2.0. Artistic License 2.0 Copyright (c) 2000-2006, The Perl Foundation. http://www.perlfoundation.org/artistic_license_2_0 Preamble This license establishes the terms under which a given free software Package may be copied, modified, distributed, and/or redistributed. The intent is that the Copyright Holder maintains some artistic control over the development of that Package while still keeping the Package available as open source and free software. You are always permitted to make arrangements wholly outside of this license directly with the Copyright Holder of a given Package. If the terms of this license do not permit the full use that you propose to make of the Package, you should contact the Copyright Holder and seek a different licensing arrangement. Definitions "Copyright Holder" means the individual(s) or organization(s) named in the copyright notice for the entire Package. "Contributor" means any party that has contributed code or other material to the Package, in accordance with the Copyright Holder's procedures. "You" and "your" means any person who would like to copy, distribute, or modify the Package. "Package" means the collection of files distributed by the Copyright Holder, and derivatives of that collection and/or of those files. A given Package may consist of either the Standard Version, or a Modified Version. "Distribute" means providing a copy of the Package or making it accessible to anyone else, or in the case of a company or organization, to others outside of your company or organization. "Distributor Fee" means any fee that you charge for Distributing this Package or providing support for this Package to another party. It does not mean licensing fees. "Standard Version" refers to the Package if it has not been modified, or has been modified only in ways explicitly requested by the Copyright Holder. "Modified Version" means the Package, if it has been changed, and such changes were not explicitly requested by the Copyright Holder. "Original License" means this Artistic License as Distributed with the Standard Version of the Package, in its current version or as it may be modified by The Perl Foundation in the future. "Source" form means the source code, documentation source, and configuration files for the Package. "Compiled" form means the compiled bytecode, object code, binary, or any other form resulting from mechanical transformation or translation of the Source form. Permission for Use and Modification Without Distribution (1) You are permitted to use the Standard Version and create and use Modified Versions for any purpose without restriction, provided that you do not Distribute the Modified Version. Permissions for Redistribution of the Standard Version (2) You may Distribute verbatim copies of the Source form of the Standard Version of this Package in any medium without restriction, either gratis or for a Distributor Fee, provided that you duplicate all of the original copyright notices and associated disclaimers. At your discretion, such verbatim copies may or may not include a Compiled form of the Package. (3) You may apply any bug fixes, portability changes, and other modifications made available from the Copyright Holder. The resulting Package will still be considered the Standard Version, and as such will be subject to the Original License. Distribution of Modified Versions of the Package as Source (4) You may Distribute your Modified Version as Source (either gratis or for a Distributor Fee, and with or without a Compiled form of the Modified Version) provided that you clearly document how it differs from the Standard Version, including, but not limited to, documenting any non-standard features, executables, or modules, and provided that you do at least ONE of the following: (a) make the Modified Version available to the Copyright Holder of the Standard Version, under the Original License, so that the Copyright Holder may include your modifications in the Standard Version. (b) ensure that installation of your Modified Version does not prevent the user installing or running the Standard Version. In addition, the Modified Version must bear a name that is different from the name of the Standard Version. (c) allow anyone who receives a copy of the Modified Version to make the Source form of the Modified Version available to others under (i) the Original License or (ii) a license that permits the licensee to freely copy, modify and redistribute the Modified Version using the same licensing terms that apply to the copy that the licensee received, and requires that the Source form of the Modified Version, and of any works derived from it, be made freely available in that license fees are prohibited but Distributor Fees are allowed. Distribution of Compiled Forms of the Standard Version or Modified Versions without the Source (5) You may Distribute Compiled forms of the Standard Version without the Source, provided that you include complete instructions on how to get the Source of the Standard Version. Such instructions must be valid at the time of your distribution. If these instructions, at any time while you are carrying out such distribution, become invalid, you must provide new instructions on demand or cease further distribution. If you provide valid instructions or cease distribution within thirty days after you become aware that the instructions are invalid, then you do not forfeit any of your rights under this license. (6) You may Distribute a Modified Version in Compiled form without the Source, provided that you comply with Section 4 with respect to the Source of the Modified Version. Aggregating or Linking the Package (7) You may aggregate the Package (either the Standard Version or Modified Version) with other packages and Distribute the resulting aggregation provided that you do not charge a licensing fee for the Package. Distributor Fees are permitted, and licensing fees for other components in the aggregation are permitted. The terms of this license apply to the use and Distribution of the Standard or Modified Versions as included in the aggregation. (8) You are permitted to link Modified and Standard Versions with other works, to embed the Package in a larger work of your own, or to build stand-alone binary or bytecode versions of applications that include the Package, and Distribute the result without restriction, provided the result does not expose a direct interface to the Package. Items That are Not Considered Part of a Modified Version (9) Works (including, but not limited to, modules and scripts) that merely extend or make use of the Package, do not, by themselves, cause the Package to be a Modified Version. In addition, such works are not considered parts of the Package itself, and are not subject to the terms of this license. General Provisions (10) Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license. (11) If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license. (12) This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder. (13) This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation IO-Interactive-1.022/Makefile.PL000644 000765 000024 00000005157 12762730712 016527 0ustar00brianstaff000000 000000 package IO::Interactive; use strict; use warnings; =encoding utf8 =head1 The build file for IO::Interactive This build file is a modulino; it works as both a build script and a module. To build the distribution, run this file normally: % perl Makefile.PL But, it's more interesting than that. You can load it with C and call C to get the data structure it passes to C: my $package = require '/path/to/Makefile.PL'; my $arguments = $package->arguments; Note that C-ing a file makes an entry in C<%INC> for exactly that name. If you try to C another file with the same name, even from a different path, C thinks it has already loaded the file. As such, I recommend you always require the full path to the file. The return value of the C is a package name (in this case, the name of the main module. Use that to call the C method. Even if this distribution needs a higher version of Perl, this bit only needs v5.8. You can play with the data structure with a primitive Perl. =cut use File::Spec::Functions qw(catfile); my $module = __PACKAGE__; ( my $dist = $module ) =~ s/::/-/g; my $github = 'https://github.com/briandfoy/io-interactive'; my $main_file = catfile( 'lib', split /::/, "$module.pm" ); my %WriteMakefile = ( 'MIN_PERL_VERSION' => '5.008', 'NAME' => $module, 'AUTHOR' => 'Damian Conway ', 'VERSION_FROM' => $main_file, 'ABSTRACT_FROM' => $main_file, 'LICENSE' => 'perl', 'CONFIGURE_REQUIRES' => { 'ExtUtils::MakeMaker' => '6.64', 'File::Spec::Functions' => '0', }, 'BUILD_REQUIRES' => { }, 'TEST_REQUIRES' => { 'Test::More' => '0.94', }, 'PREREQ_PM' => { }, 'META_MERGE' => { 'meta-spec' => { version => 2 }, resources => { repository => { type => 'git', url => "$github.git", web => $github, }, bugtracker => { web => "$github/issues", }, homepage => $github, }, }, clean => { FILES => "$dist-*" }, ); sub arguments { \%WriteMakefile } do_it() unless caller; sub do_it { require File::Spec; my $MM ='ExtUtils::MakeMaker'; my $MM_version = eval{ "$MM " . $WriteMakefile{'CONFIGURE_REQUIRES'}{'ExtUtils::MakeMaker'} } || "$MM 6.64"; eval "use $MM_version; 1" or die "Could not load $MM_version: $@"; eval "use Test::Manifest 1.21" if -e catfile( qw(t test_manifest) ); my $arguments = arguments(); my $minimum_perl = $arguments->{MIN_PERL_VERSION} || '5.008'; eval "require $minimum_perl;" or die $@; WriteMakefile( %$arguments ); } no warnings; __PACKAGE__; IO-Interactive-1.022/MANIFEST000644 000765 000024 00000000654 12762730714 015705 0ustar00brianstaff000000 000000 Changes examples/interactive.pl examples/memory_test.pl INSTALL.SKIP lib/IO/Interactive.pm LICENSE Makefile.PL MANIFEST This list of files MANIFEST.SKIP README.pod t/00.load.t t/busy.t t/interactive.t t/is_interactive.t t/pod-coverage.t t/pod.t xt/changes.t META.yml Module YAML meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker) IO-Interactive-1.022/MANIFEST.SKIP000644 000765 000024 00000001766 12762730712 016455 0ustar00brianstaff000000 000000 #!start included /usr/local/perls/perl-5.20.0/lib/5.20.0/ExtUtils/MANIFEST.SKIP # Avoid version control files. \bRCS\b \bCVS\b \bSCCS\b ,v$ \B\.svn\b \B\.git\b \B\.gitignore\b \b_darcs\b \B\.cvsignore$ # Avoid VMS specific MakeMaker generated files \bDescrip.MMS$ \bDESCRIP.MMS$ \bdescrip.mms$ # Avoid Makemaker generated and utility files. \bMANIFEST\.bak \bMakefile$ \bblib/ \bMakeMaker-\d \bpm_to_blib\.ts$ \bpm_to_blib$ \bblibdirs\.ts$ # 6.18 through 6.25 generated this # Avoid Module::Build generated and utility files. \bBuild$ \b_build/ \bBuild.bat$ \bBuild.COM$ \bBUILD.COM$ \bbuild.com$ # Avoid temp and backup files. ~$ \.old$ \#$ \b\.# \.bak$ \.tmp$ \.# \.rej$ # Avoid OS-specific files/dirs # Mac OSX metadata \B\.DS_Store # Mac OSX SMB mount metadata files \B\._ # Avoid Devel::Cover and Devel::CoverX::Covered files. \bcover_db\b \bcovered\b # Avoid MYMETA files ^MYMETA\. #!end included /usr/local/perls/perl-5.20.0/lib/5.20.0/ExtUtils/MANIFEST.SKIP \.releaserc ^IO- \.travis\.yml IO-Interactive-1.022/META.json000664 000765 000024 00000002505 12762730714 016174 0ustar00brianstaff000000 000000 { "abstract" : "Utilities for interactive I/O", "author" : [ "Damian Conway " ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.140640", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "IO-Interactive", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : {} }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.64", "File::Spec::Functions" : "0" } }, "runtime" : { "requires" : { "perl" : "5.008" } }, "test" : { "requires" : { "Test::More" : "0.94" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/briandfoy/io-interactive/issues" }, "homepage" : "https://github.com/briandfoy/io-interactive", "repository" : { "type" : "git", "url" : "https://github.com/briandfoy/io-interactive.git", "web" : "https://github.com/briandfoy/io-interactive" } }, "version" : "1.022" } IO-Interactive-1.022/META.yml000664 000765 000024 00000001320 12762730714 016016 0ustar00brianstaff000000 000000 --- abstract: 'Utilities for interactive I/O' author: - 'Damian Conway ' build_requires: Test::More: '0.94' configure_requires: ExtUtils::MakeMaker: '6.64' File::Spec::Functions: '0' dynamic_config: 1 generated_by: 'ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.140640' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: IO-Interactive no_index: directory: - t - inc requires: perl: '5.008' resources: bugtracker: https://github.com/briandfoy/io-interactive/issues homepage: https://github.com/briandfoy/io-interactive repository: https://github.com/briandfoy/io-interactive.git version: '1.022' IO-Interactive-1.022/README.pod000644 000765 000024 00000006136 12762730712 016214 0ustar00brianstaff000000 000000 =pod =encoding utf8 =head1 The IO::Interactive module This is the I for the L Perl module. You're probably looking at this because you don't know where else to find what you're looking for. Read this once and you might never have to read one again for any Perl module. =head2 Documentation To read about L, look at the embedded documentation in the module itself. Inside the distribution, you can format it with L: % perldoc lib/IO/Interactive.pm If you have already installed the module, you can specify the module name instead of the file location: % perldoc IO::Interactive You can read the documentation and inspect the meta data on one of the CPAN web interfaces, such as L or L: =over 4 =item * L =item * L =back The standard module documentation has example uses in the SYNOPSIS section, but you can also look in the I directory (if it's there), or look at the test files in I. =head2 Installation You can install this module with a CPAN client, which will resolve and install the dependencies: % cpan IO::Interactive % cpanm IO::Interactive You can also install directly from the distribution directory, which will also install the dependencies: % cpan . % cpanm . You could install just this module manually: % perl Makefile.PL % make % make test % make install You probably don't want to do that unless you're fiddling with the module and only want to run the tests without installing anything. =head2 Source location The meta data, such as the source repository and bug tracker, is in I or the I files it creates. You can find that on those CPAN web interfaces, but you can also look at files directly in the source repository: =over 4 =item * L =back If you find a problem, file a ticket in the L: =over 4 =item * L =back =head2 Getting help Although I'm happy to hear from module users in private email, that's the best way for me to forget to do something. Besides the issue trackers, you can find help at L or L, both of which have many competent Perlers who can answer your question, almost in real time. They might not know the particulars of this module, but they can help you diagnose your problem. You might like to read L. =head2 Copyright and License You should have received a I file, but the license is also noted in the module files. About the only thing you can't do is pretend that you wrote code that you didn't. =head2 Good luck! Enjoy, brian d foy, bdfoy@cpan.org =cut IO-Interactive-1.022/t/000755 000765 000024 00000000000 12762730714 015012 5ustar00brianstaff000000 000000 IO-Interactive-1.022/xt/000755 000765 000024 00000000000 12762730714 015202 5ustar00brianstaff000000 000000 IO-Interactive-1.022/xt/changes.t000644 000765 000024 00000000203 12762730712 016770 0ustar00brianstaff000000 000000 use Test::More; eval 'use Test::CPAN::Changes'; plan skip_all => 'Test::CPAN::Changes required for this test' if $@; changes_ok(); IO-Interactive-1.022/t/00.load.t000644 000765 000024 00000000201 12762730712 016323 0ustar00brianstaff000000 000000 use Test::More tests => 1; BEGIN { use_ok( 'IO::Interactive' ); } diag( "Testing IO::Interactive $IO::Interactive::VERSION" ); IO-Interactive-1.022/t/busy.t000644 000765 000024 00000000241 12762730712 016154 0ustar00brianstaff000000 000000 use IO::Interactive qw( busy ); print "1..2\n"; *ARGV = *DATA; my $fh = busy { print "ok 1\n"; sleep 3; }; print <$fh>; print ; __DATA__ ok 2 IO-Interactive-1.022/t/interactive.t000644 000765 000024 00000000466 12762730712 017520 0ustar00brianstaff000000 000000 use IO::Interactive qw( interactive ); print "1..2\n"; if (-t *STDIN && -t *STDOUT ) { print {interactive} "ok 1\n"; print {interactive(*STDOUT)} "ok 2\n"; } else { print {interactive} "not "; print "ok 1\n"; print {interactive(*STDOUT)} "not "; print "ok 2\n"; } IO-Interactive-1.022/t/is_interactive.t000644 000765 000024 00000001563 12762730712 020212 0ustar00brianstaff000000 000000 #!/usr/bin/perl -w use Test::More 'no_plan'; use IO::Interactive qw( is_interactive ); # Tests which depend on not being connected to a terminal SKIP: { skip "connected to a terminal", 2 if -t *STDIN && -t *STDOUT; ok !is_interactive(); ok !is_interactive(*STDOUT); } # Tests which depend on being connected to a terminal. SKIP: { skip "not connected to a terminal", 7 unless -t *STDIN && -t *STDOUT; ok is_interactive(); ok is_interactive(*STDOUT); { ok open my $manifest_fh, '<', "MANIFEST"; # any ol file will do. ok !is_interactive($manifest_fh); my $old_fh = select $manifest_fh; ok !is_interactive(), 'defaults to selected filehandle'; select $old_fh; } { local @ARGV = qw(-); ok is_interactive(); @ARGV = (1,2,3); ok is_interactive(); } } IO-Interactive-1.022/t/pod-coverage.t000644 000765 000024 00000000254 12762730712 017551 0ustar00brianstaff000000 000000 #!perl -T use Test::More; eval "use Test::Pod::Coverage 1.04"; plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@; all_pod_coverage_ok(); IO-Interactive-1.022/t/pod.t000644 000765 000024 00000000214 12762730712 015754 0ustar00brianstaff000000 000000 #!perl -T use Test::More; eval "use Test::Pod 1.14"; plan skip_all => "Test::Pod 1.14 required for testing POD" if $@; all_pod_files_ok(); IO-Interactive-1.022/lib/IO/000755 000765 000024 00000000000 12762730714 015624 5ustar00brianstaff000000 000000 IO-Interactive-1.022/lib/IO/Interactive.pm000644 000765 000024 00000017472 12762730712 020450 0ustar00brianstaff000000 000000 package IO::Interactive; use strict; use warnings; $IO::Interactive::VERSION = '1.022'; sub is_interactive { my ($out_handle) = (@_, select); # Default to default output handle # Not interactive if output is not to terminal... return 0 if not -t $out_handle; # If *ARGV is opened, we're interactive if... if ( tied(*ARGV) or defined(fileno(ARGV)) ) { # this is what 'Scalar::Util::openhandle *ARGV' boils down to # ...it's currently opened to the magic '-' file return -t *STDIN if defined $ARGV && $ARGV eq '-'; # ...it's at end-of-file and the next file is the magic '-' file return @ARGV>0 && $ARGV[0] eq '-' && -t *STDIN if eof *ARGV; # ...it's directly attached to the terminal return -t *ARGV; } # If *ARGV isn't opened, it will be interactive if *STDIN is attached # to a terminal. else { return -t *STDIN; } } local (*DEV_NULL, *DEV_NULL2); my $dev_null; BEGIN { pipe *DEV_NULL, *DEV_NULL2 or die "Internal error: can't create null filehandle"; $dev_null = \*DEV_NULL; } sub interactive { my ($out_handle) = (@_, \*STDOUT); # Default to STDOUT return &is_interactive ? $out_handle : $dev_null; } sub _input_pending_on { my ($fh) = @_; my $read_bits = ""; my $bit = fileno($fh); return if $bit < 0; vec($read_bits, fileno($fh), 1) = 1; select $read_bits, undef, undef, 0.1; return $read_bits; } sub busy (&) { my ($block_ref) = @_; # Non-interactive busy-ness is easy...just do it if (!is_interactive()) { $block_ref->(); open my $fh, '<', \ ""; return $fh; } # Otherwise fork off an interceptor process... my ($read, $write); pipe $read, $write; my $child = fork; # Within that interceptor process... if (!$child) { # Prepare to send back any intercepted input... use IO::Handle; close $read; $write->autoflush(1); # Intercept that input... while (1) { if (_input_pending_on(\*ARGV)) { # Read it... my $res = ; # Send it back to the parent... print {$write} $res; # Admonish them for not waiting... print {*STDERR} "That input was ignored. ", "Please don't press any keys yet.\n"; } } exit; } # Meanwhile, back in the parent... close $write; # Temporarily close the input... local *ARGV; open *ARGV, '<', \ ""; # Do the job... $block_ref->(); # Take down the interceptor... kill 9, $child; wait; # Return whatever the interceptor caught... return $read; } sub import { my ($package) = shift; my $caller = caller; # Export each sub if it's requested... for my $request ( @_ ) { no strict 'refs'; my $impl = *{$package.'::'.$request}{CODE}; if(!$impl || $request =~ m/\A _/xms) { require Carp; Carp::croak("Unknown subroutine ($request()) requested"); } *{$caller.'::'.$request} = $impl; } } 1; # Magic true value required at end of module __END__ =encoding utf8 =head1 NAME IO::Interactive - Utilities for interactive I/O =head1 VERSION This document describes IO::Interactive version 1.02 =head1 SYNOPSIS use IO::Interactive qw(is_interactive interactive busy); if ( is_interactive() ) { print "Running interactively\n"; } # or... print {interactive} "Running interactively\n"; $fh = busy { do_noninteractive_stuff(); } =head1 DESCRIPTION This module provides three utility subroutines that make it easier to develop interactive applications... =over =item C This subroutine returns true if C<*ARGV> and the currently selected filehandle (usually C<*STDOUT>) are connected to the terminal. The test is considerably more sophisticated than: -t *ARGV && -t *STDOUT as it takes into account the magic behaviour of C<*ARGV>. You can also pass C a writable filehandle, in which case it requires that filehandle be connected to a terminal (instead of the currently selected). The usual suspect here is C<*STDERR>: if ( is_interactive(*STDERR) ) { carp $warning; } =item C This subroutine returns C<*STDOUT> if C is true. If C is false, C returns a filehandle that does not print. This makes it easy to create applications that print out only when the application is interactive: print {interactive} "Please enter a value: "; my $value = <>; You can also pass C a writable filehandle, in which case it writes to that filehandle if it is connected to a terminal (instead of writing to C<*STDOUT>). Once again, the usual suspect is C<*STDERR>: print {interactive(*STDERR)} $warning; =item C This subroutine takes a block as its single argument and executes that block. Whilst the block is executed, C<*ARGV> is temporarily replaced by a closed filehandle. That is, no input from C<*ARGV> is possible in a C block. Furthermore, any attempts to send input into the C block through C<*ARGV> is intercepted and a warning message is printed to C<*STDERR>. The C call returns a filehandle that contains the intercepted input. A C block is therefore useful to prevent attempts at input when the program is busy at some non-interactive task. =back =head1 DIAGNOSTICS =over =item Unknown subroutine (%s) requested This module only exports the three subroutines described above. You asked for something else. Maybe you misspelled the subroutine you wanted. =back =head1 CONFIGURATION AND ENVIRONMENT IO::Interactive requires no configuration files or environment variables. =head1 DEPENDENCIES This module requires the C subroutine from the Scalar::Util module. =head1 INCOMPATIBILITIES None reported. =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to Github L. =head1 SOURCE AVAILABILITY This code is in GitHub: https://github.com/briandfoy/io-interactive =head1 AUTHOR Damian Conway C<< >> Currently maintained by brian d foy C<< >>. 1.01 patch DMUEY C<< dmuey@cpan.org >> =head1 LICENCE AND COPYRIGHT Copyright (c) 2005, Damian Conway C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 DISCLAIMER OF WARRANTY BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "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 SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION. 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 SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (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 SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. =cut IO-Interactive-1.022/examples/interactive.pl000644 000765 000024 00000000236 12762730712 021236 0ustar00brianstaff000000 000000 #!/usr/bin/perl -w use IO::Interactive qw(is_interactive); if( is_interactive() ) { print "interactive\n\n"; } else { print "NOT interactive\n\n"; }IO-Interactive-1.022/examples/memory_test.pl000644 000765 000024 00000000252 12762730712 021266 0ustar00brianstaff000000 000000 #!/usr/bin/perl use IO::Interactive; print "Testing memory consumption as process $$\n"; $SIG{INT} = sub { exit }; while( 1 ) { print { interactive } 'a' x 4096; }