IO-Interactive-Tiny-0.2/000755 000765 000765 00000000000 11663015274 015405 5ustar00dmueydmuey000000 000000 IO-Interactive-Tiny-0.2/Build.PL000644 000765 000765 00000000746 11661251554 016711 0ustar00dmueydmuey000000 000000 use strict; use warnings; use Module::Build; my $builder = Module::Build->new( module_name => 'IO::Interactive::Tiny', license => 'perl', dist_author => 'Daniel Muey ', dist_version_from => 'lib/IO/Interactive/Tiny.pm', requires => { 'Test::More' => 0, # for testing, I know I know: Test::XT }, add_to_cleanup => [ 'IO-Interactive-Tiny-*' ], ); $builder->create_build_script(); IO-Interactive-Tiny-0.2/Changes000644 000765 000765 00000000253 11663015232 016672 0ustar00dmueydmuey000000 000000 Revision history for IO-Interactive-Tiny 0.2 Tue Nov 22 15:56:18 2011 - duh, fix test from parent module 0.1 Thu Nov 17 11:11:09 2011 Initial release. IO-Interactive-Tiny-0.2/MANIFEST000644 000765 000765 00000000422 11663015274 016534 0ustar00dmueydmuey000000 000000 Build.PL Changes lib/IO/Interactive/Tiny.pm lib/IO/Interactive/Tiny.pod Makefile.PL MANIFEST This list of files README t/00.load.t t/01.is_interactive.t t/perlcritic.t t/pod-coverage.t t/pod.t META.yml Module meta-data (added by MakeMaker) IO-Interactive-Tiny-0.2/META.yml000644 000765 000765 00000001077 11663015274 016663 0ustar00dmueydmuey000000 000000 --- #YAML:1.0 name: IO-Interactive-Tiny version: 0.2 abstract: is_interactive() without large deps author: - Daniel Muey license: unknown distribution_type: module configure_requires: ExtUtils::MakeMaker: 0 build_requires: ExtUtils::MakeMaker: 0 requires: Test::More: 0 no_index: directory: - t - inc generated_by: ExtUtils::MakeMaker version 6.56 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 IO-Interactive-Tiny-0.2/Makefile.PL000644 000765 000765 00000001077 11661251545 017365 0ustar00dmueydmuey000000 000000 use strict; use warnings; use ExtUtils::MakeMaker; WriteMakefile( NAME => 'IO::Interactive::Tiny', AUTHOR => 'Daniel Muey ', VERSION_FROM => 'lib/IO/Interactive/Tiny.pm', ABSTRACT_FROM => 'lib/IO/Interactive/Tiny.pod', PL_FILES => {}, PREREQ_PM => { 'Test::More' => 0, # for testing, I know I know: Test::XT }, dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, clean => { FILES => 'IO-Interactive-Tiny-*' }, ); IO-Interactive-Tiny-0.2/README000644 000765 000765 00000001140 11663015254 016257 0ustar00dmueydmuey000000 000000 IO-Interactive-Tiny version 0.2 DOCUMENTATION See POD for documentation. INSTALLATION To install this module, run the following commands: perl Makefile.PL make make test make install Alternatively, to install with Module::Build, you can use the following commands: perl Build.PL ./Build ./Build test ./Build install DEPENDENCIES See DEPENDENCIES section in POD, 'requires' key in Build.PL, or 'PREREQ_PM' key in Makefile.PL COPYRIGHT AND LICENCE Copyright (C) 2011, Daniel Muey This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. IO-Interactive-Tiny-0.2/lib/000755 000765 000765 00000000000 11663015274 016153 5ustar00dmueydmuey000000 000000 IO-Interactive-Tiny-0.2/t/000755 000765 000765 00000000000 11663015274 015650 5ustar00dmueydmuey000000 000000 IO-Interactive-Tiny-0.2/t/00.load.t000644 000765 000765 00000000223 11661245361 017167 0ustar00dmueydmuey000000 000000 use Test::More tests => 1; BEGIN { use_ok( 'IO::Interactive::Tiny' ); } diag( "Testing IO::Interactive::Tiny $IO::Interactive::Tiny::VERSION" ); IO-Interactive-Tiny-0.2/t/01.is_interactive.t000644 000765 000765 00000002034 11663015161 021256 0ustar00dmueydmuey000000 000000 #!/usr/bin/perl -w use Test::More 'no_plan'; use IO::Interactive::Tiny; # Tests which depend on not being connected to a terminal SKIP: { skip "connected to a terminal", 2 if -t *STDIN && -t *STDOUT; ok !IO::Interactive::Tiny::is_interactive(); ok !IO::Interactive::Tiny::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 IO::Interactive::Tiny::is_interactive(); ok IO::Interactive::Tiny::is_interactive(*STDOUT); { ok open my $manifest_fh, '<', "MANIFEST"; # any ol file will do. ok !IO::Interactive::Tiny::is_interactive($manifest_fh); my $old_fh = select $manifest_fh; ok !IO::Interactive::Tiny::is_interactive(), 'defaults to selected filehandle'; select $old_fh; } { local @ARGV = qw(-); ok IO::Interactive::Tiny::is_interactive(); @ARGV = (1,2,3); ok IO::Interactive::Tiny::is_interactive(); } } IO-Interactive-Tiny-0.2/t/perlcritic.t000644 000765 000765 00000000466 11661240055 020176 0ustar00dmueydmuey000000 000000 #!perl -T use Test::More; eval 'use Test::Perl::Critic'; plan skip_all => 'Test::Perl::Critic required for testing PBP compliance' if $@; plan skip_all => q($ENV{'do_perl_critic_tests'} must be true to run these 'development only' tests) if !$ENV{'do_perl_critic_tests'}; Test::Perl::Critic::all_critic_ok(); IO-Interactive-Tiny-0.2/t/pod-coverage.t000644 000765 000765 00000000254 11661240055 020404 0ustar00dmueydmuey000000 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-Tiny-0.2/t/pod.t000644 000765 000765 00000000214 11661240055 016607 0ustar00dmueydmuey000000 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-Tiny-0.2/lib/IO/000755 000765 000765 00000000000 11663015274 016462 5ustar00dmueydmuey000000 000000 IO-Interactive-Tiny-0.2/lib/IO/Interactive/000755 000765 000765 00000000000 11663015274 020737 5ustar00dmueydmuey000000 000000 IO-Interactive-Tiny-0.2/lib/IO/Interactive/Tiny.pm000644 000765 000765 00000001740 11663015240 022213 0ustar00dmueydmuey000000 000000 package IO::Interactive::Tiny; # use strict; # use warnings; $IO::Interactive::Tiny::VERSION = '0.2'; 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)) ) { # IO::Interactive::Tiny: this is the only relavent part of Scalar::Util::openhandle() for 'openhandle *ARGV' # ...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; } } 1; IO-Interactive-Tiny-0.2/lib/IO/Interactive/Tiny.pod000644 000765 000765 00000007060 11663015246 022370 0ustar00dmueydmuey000000 000000 =encoding utf-8 =head1 NAME IO::Interactive::Tiny - is_interactive() without large deps =head1 VERSION This document describes IO::Interactive::Tiny version 0.2 =head1 SYNOPSIS use IO::Interactive::Tiny; if ( IO::Interactive::Tiny::is_interactive() ) { print "I probably want text output."; } else { print "I probably want HTML output."; } =head1 DESCRIPTION Provides the useful subset of L’s functionality in the form of only having is_interactive(). Also gains ::Tiny-ness by not using L, L, or L =head1 INTERFACE Nothing in exported or exportable, that helps keep it '::Tiny'. =head2 IO::Interactive::Tiny::is_interactive() Same functionality as L. =head1 DIAGNOSTICS IO::Interactive::Tiny throws no warnings or errors of its own. =head1 CONFIGURATION AND ENVIRONMENT IO::Interactive::Tiny requires no configuration files or environment variables. =head1 DEPENDENCIES None. =head1 INCOMPATIBILITIES None reported. =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to C, or through the web interface at L. =head1 About the '::Tiny' status All info below is relative to IO::Interactive (v0.0.6). See L for information on the ::Tiny suffix. #3 is really really close: [ -- RSS Memory -- ] Baseline perl 1204 IO::Interactive 2464 (+1260) IO::Interactive::Tiny 1332 (+128) Even though "time" isn't really a ::Tiny factor, it does improve loading a bit: [ -- time -- ] Baseline perl real 0m0.014s user 0m0.004s sys 0m0.008s IO::Interactive real 0m0.023s user 0m0.013s sys 0m0.009s IO::Interactive::Tiny real 0m0.013s user 0m0.004s sys 0m0.008s Regarding tests: t/01.is_interactive.t i the same as t/is_interactive.t in IO::Interactive =head1 AUTHOR Daniel Muey C<< >> =head1 LICENCE AND COPYRIGHT Copyright (c) 2011, Daniel Muey C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =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.