The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
Changes 031
MANIFEST 01
META.json 11
META.yml 11
Makefile.PL 11
README 36
lib/IO/All/Base.pm 21
lib/IO/All/DBM.pm 21
lib/IO/All/Dir.pm 21
lib/IO/All/File.pm 21
lib/IO/All/Filesys.pm 21
lib/IO/All/Link.pm 21
lib/IO/All/MLDBM.pm 21
lib/IO/All/Pipe.pm 21
lib/IO/All/STDIO.pm 21
lib/IO/All/Socket.pm 21
lib/IO/All/String.pm 21
lib/IO/All/Temp.pm 21
lib/IO/All.pm 52
lib/IO/All.pod 36
t/000-compile-modules.t 017
t/IO_All_Test.pm 43
t/RT81224.t 63
t/absolute.t 63
t/accept.t 53
t/all.t 4744
t/all2.t 74
t/append.t 42
t/assert.t 42
t/assert2.t 42
t/autotie.t 53
t/backwards.t 96
t/binary_utf8.t 42
t/chdir.t 74
t/chomp.t 63
t/construct.t 1714
t/dbm.t 42
t/devnull.t 42
t/empty.t 42
t/encoding.t 1310
t/error1.t 42
t/file_spec.t 1512
t/file_subclass.t 42
t/fileno.t 42
t/glob.t 53
t/head.t 22
t/import_flags.t 42
t/inline_subclass.t 42
t/input.t 2118
t/link.t 42
t/link2.t 63
t/lock.t 42
t/mldbm.t 42
t/new.t 53
t/os.t 42
t/overload.t 2230
t/pipe.t 41
t/print.t 42
t/println.t 74
t/read.t 63
t/read_write.t 42
t/round_robin.t 63
t/scalar.t 74
t/seek.t 63
t/separator.t 42
t/stat.t 74
t/string_open.t 42
t/subtleties.t 42
t/synopsis1.t 1411
t/synopsis2.t 74
t/synopsis3.t 118
t/synopsis5.t 63
t/text.big5 11
t/text.utf8 11
t/tie.t 74
t/tie_file.t 63
76 files changed (This is a version diff) 426348
@@ -1,3 +1,34 @@
+0.77 Tue Aug 26 12:37:29 PDT 2014
+ - Add new overloads from PR/49 @ginzel++
+
+0.76 Tue Aug 19 16:21:05 PDT 2014
+ - Relplace tabs with spaces
+
+0.75 Sat Aug 16 16:41:13 PDT 2014
+ - Change testdir to t
+
+0.74 Sat Aug 16 16:03:33 PDT 2014
+ - Fix strict/warnings
+
+0.73 Sat Aug 16 15:35:55 PDT 2014
+ - Remove 'use 5.x.x' from code
+
+0.72 Sat Aug 16 11:19:00 PDT 2014
+ - Meta 0.0.2
+
+0.71 Sat Aug 16 03:45:11 PDT 2014
+ - Eliminate spurious trailing whitespace
+
+0.70 Sat Aug 16 02:08:08 PDT 2014
+ - Eliminate File::Basename from test/
+
+0.69 Fri Aug 15 15:55:18 PDT 2014
+ - Add t/000-compile-modules.t
+ - CPAN Day 2014 - 21 Release Salute!
+
+0.68 Sun Aug 10 08:56:08 PDT 2014
+ - PR/47. Doc fixes. @ginzel++
+
 0.67 Sat Aug  2 11:58:01 PDT 2014
  - Fix Copyright years.
 
@@ -33,6 +33,7 @@ lib/IO/All/String.pm
 lib/IO/All/String.pod
 lib/IO/All/Temp.pm
 lib/IO/All/Temp.pod
+t/000-compile-modules.t
 t/IO_All_Test.pm
 t/IO_Dumper.pm
 t/RT81224.t
@@ -56,6 +56,6 @@
          "web" : "https://github.com/ingydotnet/io-all-pm"
       }
    },
-   "version" : "0.67"
+   "version" : "0.77"
 }
 
@@ -29,4 +29,4 @@ resources:
   bugtracker: https://github.com/ingydotnet/io-all-pm/issues
   homepage: https://github.com/ingydotnet/io-all-pm
   repository: https://github.com/ingydotnet/io-all-pm.git
-version: '0.67'
+version: '0.77'
@@ -23,7 +23,7 @@ my %WriteMakefileArgs = (
     "Cwd" => 0,
     "Scalar::Util" => 0
   },
-  "VERSION" => "0.67",
+  "VERSION" => "0.77",
   "test" => {
     "TESTS" => "t/*.t"
   }
@@ -41,6 +41,9 @@ SYNOPSIS
         io('copy.txt') < io('file.txt');            $ Copy a file
         io('file.txt') > io('copy.txt');            # Invokes File::Copy
         io('more.txt') >> io('all.txt');            # Add on to a file
+        io('dir/') < io('file.txt');                $ Copy a file to a directory
+        io('file.txt') > io('dir/');                # Invokes File::Copy
+        io('more.txt') >> io('dir/');               # Add on to a file in the dir
 
         # UTF-8 Support
         $contents = io('file.txt')->utf8->all;      # Turn on utf8
@@ -186,7 +189,7 @@ USAGE
     and IO::All will export a single function called "io", which constructs
     all IO objects.
 
-  Note on `io`
+  Note on "io"
     The "io" function is a *magic constructor*. It is easy to use and will
     usually do the right thing, but can also blow up easily.
 
@@ -521,7 +524,7 @@ THE IO::ALL METHODS
             - A directory name
             - A directory handle
             - A typeglob reference
-            - A piped shell command. eq '| ls -al'
+            - A piped shell command. eg '| ls -al'
             - A socket domain/port.  eg 'perl.com:5678'
             - '-' means STDIN or STDOUT (depending on usage)
             - '=' means STDERR
@@ -1352,7 +1355,7 @@ THE IO::ALL METHODS
         Returns an IO::All object representing the current directory.
 
     devnull
-        Returns an IO::All object representing the *dev*null file.
+        Returns an IO::All object representing the "/dev/null" file.
 
     is_absolute
         Returns 0 or 1 indicating whether the "name" field of the IO::All
@@ -1,7 +1,6 @@
+use strict; use warnings;
 package IO::All::Base;
 
-use strict;
-use warnings;
 use Fcntl;
 
 sub import {
@@ -1,7 +1,6 @@
+use strict; use warnings;
 package IO::All::DBM;
 
-use strict;
-use warnings;
 use IO::All::File -base;
 use Fcntl;
 
@@ -1,7 +1,6 @@
+use strict; use warnings;
 package IO::All::Dir;
 
-use strict;
-use warnings;
 use Scalar::Util 'blessed';
 use IO::All::Filesys -base;
 use IO::All -base;
@@ -1,7 +1,6 @@
+use strict; use warnings;
 package IO::All::File;
 
-use strict;
-use warnings;
 use IO::All::Filesys -base;
 use IO::All -base;
 use IO::File;
@@ -1,7 +1,6 @@
+use strict; use warnings;
 package IO::All::Filesys;
 
-use strict;
-use warnings;
 use IO::All::Base -base;
 use Fcntl qw(:flock);
 
@@ -1,7 +1,6 @@
+use strict; use warnings;
 package IO::All::Link;
 
-use strict;
-use warnings;
 use IO::All::File -base;
 
 const type => 'link';
@@ -1,7 +1,6 @@
+use strict; use warnings;
 package IO::All::MLDBM;
 
-use strict;
-use warnings;
 use IO::All::DBM -base;
 
 field _serializer => 'Data::Dumper';
@@ -1,7 +1,6 @@
+use strict; use warnings;
 package IO::All::Pipe;
 
-use strict;
-use warnings;
 use IO::All -base;
 use IO::File;
 
@@ -1,7 +1,6 @@
+use strict; use warnings;
 package IO::All::STDIO;
 
-use strict;
-use warnings;
 use IO::All -base;
 use IO::File;
 
@@ -1,7 +1,6 @@
+use strict; use warnings;
 package IO::All::Socket;
 
-use strict;
-use warnings;
 use IO::All -base;
 use IO::Socket;
 
@@ -1,7 +1,6 @@
+use strict; use warnings;
 package IO::All::String;
 
-use strict;
-use warnings;
 use IO::All -base;
 
 const type => 'string';
@@ -1,7 +1,6 @@
+use strict; use warnings;
 package IO::All::Temp;
 
-use strict;
-use warnings;
 use IO::All::File -base;
 
 sub temp {
@@ -1,9 +1,6 @@
+use strict; use warnings;
 package IO::All;
-our $VERSION = '0.67';
-
-use 5.006001;
-use strict;
-use warnings;
+our $VERSION = '0.77';
 
 require Carp;
 # So one can use Carp::carp "$message" - without the parenthesis.
@@ -54,6 +54,9 @@ you write code very quickly, though they should be used judiciously:
     io('copy.txt') < io('file.txt');            $ Copy a file
     io('file.txt') > io('copy.txt');            # Invokes File::Copy
     io('more.txt') >> io('all.txt');            # Add on to a file
+    io('dir/') < io('file.txt');                $ Copy a file to a directory
+    io('file.txt') > io('dir/');                # Invokes File::Copy
+    io('more.txt') >> io('dir/');               # Add on to a file in the dir
 
     # UTF-8 Support
     $contents = io('file.txt')->utf8->all;      # Turn on utf8
@@ -201,7 +204,7 @@ Normally just say:
 and IO::All will export a single function called C<io>, which constructs all
 IO objects.
 
-=head2 Note on `io`
+=head2 Note on C<io>
 
 The C<io> function is a I<magic constructor>. It is easy to use and will
 usually do the right thing, but can also blow up easily.
@@ -547,7 +550,7 @@ can be any of the following:
     - A directory name
     - A directory handle
     - A typeglob reference
-    - A piped shell command. eq '| ls -al'
+    - A piped shell command. eg '| ls -al'
     - A socket domain/port.  eg 'perl.com:5678'
     - '-' means STDIN or STDOUT (depending on usage)
     - '=' means STDERR
@@ -1556,7 +1559,7 @@ Returns an IO::All object representing the current directory.
 
 =item devnull
 
-Returns an IO::All object representing the I<dev>null file.
+Returns an IO::All object representing the C</dev/null> file.
 
 =item is_absolute
 
@@ -0,0 +1,17 @@
+# This test does a basic `use` check on all the code.
+use Test::More;
+
+use File::Find;
+
+sub test {
+    s{^lib/(.*)\.pm$}{$1} or return;
+    s{/}{::}g;
+    use_ok $_;
+}
+
+find {
+    wanted => \&test,
+    no_chdir => 1,
+}, 'lib';
+
+done_testing;
@@ -61,14 +61,13 @@ use vars qw($output_dir);
 BEGIN {
     use FindBin qw($Script);
     use File::Temp qw(tempdir);
-    use File::Basename;
-    my $testdir = dirname(__FILE__);
+    my $t = -e 't' ? 't' : 'test';
 
     if ($Script =~ m{([\w\-]+)\.t\z}) {
-        $output_dir = "$testdir/output__$1";
+        $output_dir = "$t/output__$1";
     }
     else {
-        $output_dir = tempdir("$testdir/output__XXXXXXXX");
+        $output_dir = tempdir("$t/output__XXXXXXXX");
     }
 }
 
@@ -1,11 +1,8 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+my $t; use lib ($t = -e 't' ? 't' : 'test');
 use Test::More tests => 1;
 use IO::All -utf8;
 my $warnings = 0;
-my $testdir = dirname(__FILE__);
 $SIG{__WARN__} = sub { $warnings++ };
-my $img = io("$testdir/img.jpg")->binary->all;
+my $img = io("$t/img.jpg")->binary->all;
 ok(!$warnings, 'no unicode warnings');
@@ -1,20 +1,17 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
 use Test::More tests => 3;
+my $t; use lib ($t = -e 't' ? 't' : 'test');
 use IO::All;
 use IO_All_Test;
 use diagnostics;
 
 my $io = io($0);
 
-my $testdir = dirname(__FILE__);
 $io->absolute;
 is("$io", File::Spec->rel2abs($0));
 $io->relative;
 is($io->pathname, File::Spec->abs2rel($0));
 
-ok(io($testdir)->absolute->next->is_absolute);
+ok(io($t)->absolute->next->is_absolute);
 
 del_output_dir();
@@ -1,10 +1,8 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+use lib -e 't' ? 't' : 'test';
 use Test::More tests => 20;
-use IO::All;
 use IO_All_Test;
+use IO::All;
 use IO::Socket::INET;
 
 # This test tests for the ability of a non-forking socket to handle more
@@ -1,56 +1,53 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+my $t; use lib ($t = -e 't' ? 't' : 'test');
 use Test::More tests => 30;
 use IO::All;
 use IO_All_Test;
 
-my $testdir = dirname(__FILE__);
-my $expected1 = "$testdir/mydir/dir1;$testdir/mydir/dir2;$testdir/mydir/file1;$testdir/mydir/file2;$testdir/mydir/file3";
-my $expected2 = "$testdir/mydir/dir1;$testdir/mydir/dir1/dira;$testdir/mydir/dir1/file1;$testdir/mydir/dir2;$testdir/mydir/dir2/file1;$testdir/mydir/file1;$testdir/mydir/file2;$testdir/mydir/file3";
-my $expected3 = "$testdir/mydir/dir1;$testdir/mydir/dir1/dira;$testdir/mydir/dir1/dira/dirx;$testdir/mydir/dir1/file1;$testdir/mydir/dir2;$testdir/mydir/dir2/file1;$testdir/mydir/file1;$testdir/mydir/file2;$testdir/mydir/file3";
-my $expected4 = "$testdir/mydir/dir1;$testdir/mydir/dir1/dira;$testdir/mydir/dir1/dira/dirx;$testdir/mydir/dir1/dira/dirx/file1;$testdir/mydir/dir1/file1;$testdir/mydir/dir2;$testdir/mydir/dir2/file1;$testdir/mydir/file1;$testdir/mydir/file2;$testdir/mydir/file3";
-my $expected_files1 = "$testdir/mydir/file1;$testdir/mydir/file2;$testdir/mydir/file3";
-my $expected_files2 = "$testdir/mydir/dir1/file1;$testdir/mydir/dir2/file1;$testdir/mydir/file1;$testdir/mydir/file2;$testdir/mydir/file3";
-my $expected_files4 = "$testdir/mydir/dir1/dira/dirx/file1;$testdir/mydir/dir1/file1;$testdir/mydir/dir2/file1;$testdir/mydir/file1;$testdir/mydir/file2;$testdir/mydir/file3";
-my $expected_dirs1 = "$testdir/mydir/dir1;$testdir/mydir/dir2";
-my $expected_dirs2 = "$testdir/mydir/dir1;$testdir/mydir/dir1/dira;$testdir/mydir/dir2";
-my $expected_dirs3 = "$testdir/mydir/dir1;$testdir/mydir/dir1/dira;$testdir/mydir/dir1/dira/dirx;$testdir/mydir/dir2";
-my $expected_filt1 = "$testdir/mydir/dir1/dira;$testdir/mydir/dir1/dira/dirx";
-my $expected_filt2 = "$testdir/mydir/dir1/dira/dirx";
+my $expected1 = "$t/mydir/dir1;$t/mydir/dir2;$t/mydir/file1;$t/mydir/file2;$t/mydir/file3";
+my $expected2 = "$t/mydir/dir1;$t/mydir/dir1/dira;$t/mydir/dir1/file1;$t/mydir/dir2;$t/mydir/dir2/file1;$t/mydir/file1;$t/mydir/file2;$t/mydir/file3";
+my $expected3 = "$t/mydir/dir1;$t/mydir/dir1/dira;$t/mydir/dir1/dira/dirx;$t/mydir/dir1/file1;$t/mydir/dir2;$t/mydir/dir2/file1;$t/mydir/file1;$t/mydir/file2;$t/mydir/file3";
+my $expected4 = "$t/mydir/dir1;$t/mydir/dir1/dira;$t/mydir/dir1/dira/dirx;$t/mydir/dir1/dira/dirx/file1;$t/mydir/dir1/file1;$t/mydir/dir2;$t/mydir/dir2/file1;$t/mydir/file1;$t/mydir/file2;$t/mydir/file3";
+my $expected_files1 = "$t/mydir/file1;$t/mydir/file2;$t/mydir/file3";
+my $expected_files2 = "$t/mydir/dir1/file1;$t/mydir/dir2/file1;$t/mydir/file1;$t/mydir/file2;$t/mydir/file3";
+my $expected_files4 = "$t/mydir/dir1/dira/dirx/file1;$t/mydir/dir1/file1;$t/mydir/dir2/file1;$t/mydir/file1;$t/mydir/file2;$t/mydir/file3";
+my $expected_dirs1 = "$t/mydir/dir1;$t/mydir/dir2";
+my $expected_dirs2 = "$t/mydir/dir1;$t/mydir/dir1/dira;$t/mydir/dir2";
+my $expected_dirs3 = "$t/mydir/dir1;$t/mydir/dir1/dira;$t/mydir/dir1/dira/dirx;$t/mydir/dir2";
+my $expected_filt1 = "$t/mydir/dir1/dira;$t/mydir/dir1/dira/dirx";
+my $expected_filt2 = "$t/mydir/dir1/dira/dirx";
 
 sub prep { join ';', grep { not /CVS|\.svn/ } @_ }
 
-is(prep(io("$testdir/mydir")->all), f$expected1);
-is(prep(io("$testdir/mydir")->all(1)), f$expected1);
-is(prep(io("$testdir/mydir")->all(2)), f$expected2);
-is(prep(io("$testdir/mydir")->all(3)), f$expected3);
-is(prep(io("$testdir/mydir")->all(4)), f$expected4);
-is(prep(io("$testdir/mydir")->all(5)), f$expected4);
-is(prep(io("$testdir/mydir")->all(0)), f$expected4);
-is(prep(io("$testdir/mydir")->All), f$expected4);
-is(prep(io("$testdir/mydir")->deep->all), f$expected4);
-is(prep(io("$testdir/mydir")->all_files), f$expected_files1);
-is(prep(io("$testdir/mydir")->all_files(1)), f$expected_files1);
-is(prep(io("$testdir/mydir")->all_files(2)), f$expected_files2);
-is(prep(io("$testdir/mydir")->all_files(3)), f$expected_files2);
-is(prep(io("$testdir/mydir")->all_files(4)), f$expected_files4);
-is(prep(io("$testdir/mydir")->all_files(5)), f$expected_files4);
-is(prep(io("$testdir/mydir")->all_files(0)), f$expected_files4);
-is(prep(io("$testdir/mydir")->All_Files), f$expected_files4);
-is(prep(io("$testdir/mydir")->deep->all_files), f$expected_files4);
-is(prep(io("$testdir/mydir")->All_Files(2)), f$expected_files4);
-is(prep(io("$testdir/mydir")->all_dirs), f$expected_dirs1);
-is(prep(io("$testdir/mydir")->all_dirs(1)), f$expected_dirs1);
-is(prep(io("$testdir/mydir")->all_dirs(2)), f$expected_dirs2);
-is(prep(io("$testdir/mydir")->all_dirs(3)), f$expected_dirs3);
-is(prep(io("$testdir/mydir")->all_dirs(4)), f$expected_dirs3);
-is(prep(io("$testdir/mydir")->all_dirs(5)), f$expected_dirs3);
-is(prep(io("$testdir/mydir")->all_dirs(0)), f$expected_dirs3);
-is(prep(io("$testdir/mydir")->All_Dirs), f$expected_dirs3);
-is(prep(io("$testdir/mydir")->deep->all_dirs), f$expected_dirs3);
-is(prep(io("$testdir/mydir")->filter(sub {/dira/})->All_Dirs), f$expected_filt1);
-is(prep(io("$testdir/mydir")->filter(sub {/x/})->All_Dirs), f$expected_filt2);
+is(prep(io("$t/mydir")->all), f$expected1);
+is(prep(io("$t/mydir")->all(1)), f$expected1);
+is(prep(io("$t/mydir")->all(2)), f$expected2);
+is(prep(io("$t/mydir")->all(3)), f$expected3);
+is(prep(io("$t/mydir")->all(4)), f$expected4);
+is(prep(io("$t/mydir")->all(5)), f$expected4);
+is(prep(io("$t/mydir")->all(0)), f$expected4);
+is(prep(io("$t/mydir")->All), f$expected4);
+is(prep(io("$t/mydir")->deep->all), f$expected4);
+is(prep(io("$t/mydir")->all_files), f$expected_files1);
+is(prep(io("$t/mydir")->all_files(1)), f$expected_files1);
+is(prep(io("$t/mydir")->all_files(2)), f$expected_files2);
+is(prep(io("$t/mydir")->all_files(3)), f$expected_files2);
+is(prep(io("$t/mydir")->all_files(4)), f$expected_files4);
+is(prep(io("$t/mydir")->all_files(5)), f$expected_files4);
+is(prep(io("$t/mydir")->all_files(0)), f$expected_files4);
+is(prep(io("$t/mydir")->All_Files), f$expected_files4);
+is(prep(io("$t/mydir")->deep->all_files), f$expected_files4);
+is(prep(io("$t/mydir")->All_Files(2)), f$expected_files4);
+is(prep(io("$t/mydir")->all_dirs), f$expected_dirs1);
+is(prep(io("$t/mydir")->all_dirs(1)), f$expected_dirs1);
+is(prep(io("$t/mydir")->all_dirs(2)), f$expected_dirs2);
+is(prep(io("$t/mydir")->all_dirs(3)), f$expected_dirs3);
+is(prep(io("$t/mydir")->all_dirs(4)), f$expected_dirs3);
+is(prep(io("$t/mydir")->all_dirs(5)), f$expected_dirs3);
+is(prep(io("$t/mydir")->all_dirs(0)), f$expected_dirs3);
+is(prep(io("$t/mydir")->All_Dirs), f$expected_dirs3);
+is(prep(io("$t/mydir")->deep->all_dirs), f$expected_dirs3);
+is(prep(io("$t/mydir")->filter(sub {/dira/})->All_Dirs), f$expected_filt1);
+is(prep(io("$t/mydir")->filter(sub {/x/})->All_Dirs), f$expected_filt2);
 
 del_output_dir();
@@ -1,13 +1,10 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+my $t; use lib ($t = -e 't' ? 't' : 'test');
 use Test::More tests => 2;
 use IO::All;
 use IO_All_Test;
 
-my $testdir = dirname(__FILE__);
-test_file_contents(io->file("$testdir/all2.t")->all, "$testdir/all2.t");
-test_file_contents(io->file("$testdir/all2.t")->scalar, "$testdir/all2.t");
+test_file_contents(io->file("$t/all2.t")->all, "$t/all2.t");
+test_file_contents(io->file("$t/all2.t")->scalar, "$t/all2.t");
 
 del_output_dir();
@@ -1,7 +1,5 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+use lib -e 't' ? 't' : 'test';
 use Test::More;
 use IO::All;
 use IO_All_Test;
@@ -1,7 +1,5 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+use lib -e 't' ? 't' : 'test';
 use Test::More tests => 8;
 use IO::All;
 use IO_All_Test;
@@ -1,7 +1,5 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+use lib -e 't' ? 't' : 'test';
 use Test::More tests => 4;
 use IO::All;
 use IO_All_Test;
@@ -1,13 +1,11 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+my $t; use lib ($t = -e 't' ? 't' : 'test');
 use File::Spec::Functions;
 use Test::More;
 use IO::All;
 use IO_All_Test;
 
-my $f = catfile(dirname(__FILE__), 'mystuff');
+my $f = catfile($t, 'mystuff');
 my @lines = read_file_lines($f);
 plan(tests => 1 + @lines + 1);
 
@@ -1,7 +1,5 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+my $t; use lib ($t = -e 't' ? 't' : 'test');
 use Test::More;
 use IO::All;
 use IO_All_Test;
@@ -11,18 +9,17 @@ plan((eval {require File::ReadBackwards; 1})
     : (skip_all => "requires File::ReadBackwards")
 );
 
-my $testdir = dirname(__FILE__);
 my @reversed;
-my $io = io("$testdir/mystuff");
+my $io = io("$t/mystuff");
 $io->backwards;
 while (my $line = $io->getline) {
     push @reversed, $line;
 }
 
-test_file_contents(join('', reverse @reversed), "$testdir/mystuff");
+test_file_contents(join('', reverse @reversed), "$t/mystuff");
 
-@reversed = io("$testdir/mystuff")->backwards->getlines;
+@reversed = io("$t/mystuff")->backwards->getlines;
 
-test_file_contents(join('', reverse @reversed), "$testdir/mystuff");
+test_file_contents(join('', reverse @reversed), "$t/mystuff");
 
 del_output_dir();
@@ -1,7 +1,5 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+use lib -e 't' ? 't' : 'test';
 use utf8;
 
 use Test::More tests => 8;
@@ -1,16 +1,13 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+my $t; use lib ($t = -e 't' ? 't' : 'test');
 use Test::More tests => 1;
 use IO::All;
 use IO_All_Test;
 use Cwd;
 
-my $testdir = dirname(__FILE__);
 {
-    my $dir = io($testdir)->chdir;
-    is((io(io->curdir->absolute->pathname)->splitdir)[-1], $testdir);
+    my $dir = io($t)->chdir;
+    is((io(io->curdir->absolute->pathname)->splitdir)[-1], $t);
 }
 
 del_output_dir();
@@ -1,13 +1,10 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+my $t; use lib ($t = -e 't' ? 't' : 'test');
 use Test::More 'no_plan';
 use IO::All;
 use IO_All_Test;
 
-my $testdir = dirname(__FILE__);
-my $io = io("$testdir/chomp.t")->chomp;
+my $io = io("$t/chomp.t")->chomp;
 for ($io->slurp) {
     ok(not /\n/);
 }
@@ -1,40 +1,37 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+my $t; use lib ($t = -e 't' ? 't' : 'test');
 use Test::More tests => 18;
 use IO::All;
 use IO_All_Test;
 
-my $testdir = dirname(__FILE__);
-my $io1 = IO::All->new("$testdir/mystuff");
+my $io1 = IO::All->new("$t/mystuff");
 is(ref($io1), 'IO::All::File');
-test_file_contents($$io1, "$testdir/mystuff");
+test_file_contents($$io1, "$t/mystuff");
 
-my $io2 = io("$testdir/mystuff");
+my $io2 = io("$t/mystuff");
 is(ref($io2), 'IO::All::File');
-test_file_contents($$io2, "$testdir/mystuff");
+test_file_contents($$io2, "$t/mystuff");
 
-my $io3 = io->file("$testdir/mystuff");
+my $io3 = io->file("$t/mystuff");
 is(ref($io3), 'IO::All::File');
-test_file_contents($$io3, "$testdir/mystuff");
+test_file_contents($$io3, "$t/mystuff");
 
-my $io4 = $io3->file("$testdir/construct.t");
+my $io4 = $io3->file("$t/construct.t");
 is(ref($io4), 'IO::All::File');
-test_file_contents($$io4, "$testdir/construct.t");
+test_file_contents($$io4, "$t/construct.t");
 
-my $io5 = io->dir("$testdir/mydir");
+my $io5 = io->dir("$t/mydir");
 is(ref($io5), 'IO::All::Dir');
 is(join('+', map $_->filename, grep {! /CVS|\.svn/} $io5->all), 'dir1+dir2+file1+file2+file3');
 
-my $io6 = io->rdonly->new->file("$testdir/construct.t");
+my $io6 = io->rdonly->new->file("$t/construct.t");
 ok($io6->_rdonly);
 
 SKIP: {
     eval {require Tie::File};
-    skip "requires Tie::File", 1	if $@;
+    skip "requires Tie::File", 1 if $@;
 
-    test_file_contents(join('', map {"$_\n"} @$io6), "$testdir/construct.t");
+    test_file_contents(join('', map {"$_\n"} @$io6), "$t/construct.t");
 }
 
 my $io7 = io->socket('foo.com:80')->get_socket_domain_port;
@@ -1,7 +1,5 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+use lib -e 't' ? 't' : 'test';
 
 my $db_file;
 BEGIN {
@@ -1,7 +1,5 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+use lib -e 't' ? 't' : 'test';
 use Test::More tests => 2;
 use IO::All;
 use IO_All_Test;
@@ -1,7 +1,5 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+use lib -e 't' ? 't' : 'test';
 use Test::More tests => 5;
 use IO::All;
 use IO_All_Test;
@@ -1,7 +1,5 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+my $t; use lib ($t = -e 't' ? 't' : 'test');
 use Test::More;
 use IO_All_Test;
 
@@ -28,21 +26,20 @@ use IO::All -encoding => 'big5';
 
 package main;
 
-my $testdir = dirname(__FILE__);
-isnt Normal::io("$testdir/text.big5")->all,
-     Normal::io("$testdir/text.utf8")->all,
+isnt Normal::io("$t/text.big5")->all,
+     Normal::io("$t/text.utf8")->all,
      'big5 and utf8 tests are different';
 
-isnt Normal::io("$testdir/text.big5")->all,
-     Big5::io("$testdir/text.big5")->all,
+isnt Normal::io("$t/text.big5")->all,
+     Big5::io("$t/text.big5")->all,
      'Read big5 with different io-s does not match';
 
-is UTF8::io("$testdir/text.utf8")->all,
-   Big5::io("$testdir/text.big5")->all,
+is UTF8::io("$t/text.utf8")->all,
+   Big5::io("$t/text.big5")->all,
    'Big5 text matches utf8 text after read';
 
-is Normal::io("$testdir/text.utf8")->utf8->all,
-   Normal::io("$testdir/text.big5")->encoding('big5')->all,
+is Normal::io("$t/text.utf8")->utf8->all,
+   Normal::io("$t/text.big5")->encoding('big5')->all,
    'Big5 text matches utf8 text after read';
 
 
@@ -1,7 +1,5 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+use lib -e 't' ? 't' : 'test';
 use Test::More tests => 2;
 use IO::All;
 
@@ -1,21 +1,18 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+my $t; use lib ($t = -e 't' ? 't' : 'test');
 use Test::More tests => 33;
 use IO::All;
 use IO_All_Test;
 
-my $testdir = -e 'test' ? 'test' : 't';
-my $path = f("$testdir/file_spec.t");
-like(io("././$testdir/file_spec.t")->canonpath, qr/\Q$path\E$/, 'give full canonical path for real files' );
-is(io("././$testdir/file_spec.t")->ext, 't');
-is(io("././$testdir/file_spec.t")->extension, 't');
-$path = f("$testdir/bogus");
-like(io("././$testdir/bogus")->canonpath, qr/\Q$path\E$/, 'give full canonical path for files that could exist');
-is(join(';', grep {! /CVS|\.svn/} io->catdir($testdir, 'mydir')->all), f "$testdir/mydir/dir1;$testdir/mydir/dir2;$testdir/mydir/file1;$testdir/mydir/file2;$testdir/mydir/file3");
-test_file_contents(io->catfile($testdir, 'mystuff')->scalar, "$testdir/mystuff");
-test_file_contents(io->join($testdir, 'mystuff')->scalar, "$testdir/mystuff");
+my $path = f("$t/file_spec.t");
+like(io("././$t/file_spec.t")->canonpath, qr/\Q$path\E$/, 'give full canonical path for real files' );
+is(io("././$t/file_spec.t")->ext, 't');
+is(io("././$t/file_spec.t")->extension, 't');
+$path = f("$t/bogus");
+like(io("././$t/bogus")->canonpath, qr/\Q$path\E$/, 'give full canonical path for files that could exist');
+is(join(';', grep {! /CVS|\.svn/} io->catdir($t, 'mydir')->all), f "$t/mydir/dir1;$t/mydir/dir2;$t/mydir/file1;$t/mydir/file2;$t/mydir/file3");
+test_file_contents(io->catfile($t, 'mystuff')->scalar, "$t/mystuff");
+test_file_contents(io->join($t, 'mystuff')->scalar, "$t/mystuff");
 is(ref(io->devnull), 'IO::All::File');
 ok(io->devnull->print('IO::All'));
 # Not supporting class calls anymore. Objects only.
@@ -42,7 +39,7 @@ is($f, 'bar');
 my @dirs = io('foo/bar/baz')->splitdir;
 is(scalar(@dirs), 3);
 is(join('+', @dirs), 'foo+bar+baz');
-test_file_contents(io->catpath('', $testdir, 'mystuff')->scalar, "$testdir/mystuff");
+test_file_contents(io->catpath('', $t, 'mystuff')->scalar, "$t/mystuff");
 is(io('/foo/bar/baz')->abs2rel('/foo'), f 'bar/baz');
 is(io('foo/bar/baz')->rel2abs('/moo'), f '/moo/foo/bar/baz');
 
@@ -1,7 +1,5 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+use lib -e 't' ? 't' : 'test';
 use Test::More tests => 5;
 use IO_Dumper;
 use IO_All_Test;
@@ -1,7 +1,5 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+use lib -e 't' ? 't' : 'test';
 use Test::More;
 use IO::All;
 use IO_All_Test;
@@ -1,13 +1,11 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+my $t; use lib ($t = -e 't' ? 't' : 'test');
 use Test::More tests => 1;
 use IO::All;
 use IO_All_Test;
 
 my @foo = sort map $_->filename,
-    io()->dir(dirname(__FILE__), 'mydir')->glob('f*');
+    io()->dir($t, 'mydir')->glob('f*');
 is_deeply(\@foo, [qw( file1 file2 file3 )]);
 
 del_output_dir();
@@ -8,8 +8,8 @@ use Test::More tests => 2;
 
 use IO::All;
 
-my $testdir = -e 'test' ? 'test' : 't';
-my $fn = File::Spec->catfile(File::Spec->curdir, $testdir, 'data', 'head_test.txt');
+my $t = -e 't' ? 't' : 'test';
+my $fn = File::Spec->catfile(File::Spec->curdir, $t, 'data', 'head_test.txt');
 
 {
     # See: https://github.com/ingydotnet/io-all-pm/issues/44
@@ -1,7 +1,5 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+use lib -e 't' ? 't' : 'test';
 use Test::More;
 use IO_All_Test;
 
@@ -1,7 +1,5 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+use lib -e 't' ? 't' : 'test';
 
 package IO::Dumper;
 use IO::All -base;
@@ -1,53 +1,50 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+my $t; use lib ($t = -e 't' ? 't' : 'test');
 use Test::More tests => 12;
 use IO::All;
 use IO_All_Test;
 
-my $testdir = dirname(__FILE__);
-io("$testdir/input.t") > my $contents;
-test_file_contents($contents, "$testdir/input.t");
+io("$t/input.t") > my $contents;
+test_file_contents($contents, "$t/input.t");
 
-$contents < io "$testdir/input.t";
-test_file_contents($contents, "$testdir/input.t");
+$contents < io "$t/input.t";
+test_file_contents($contents, "$t/input.t");
 
-my $io = io "$testdir/input.t";
+my $io = io "$t/input.t";
 $contents = $$io;
-test_file_contents($contents, "$testdir/input.t");
+test_file_contents($contents, "$t/input.t");
 
 $contents = $io->slurp;
-test_file_contents($contents, "$testdir/input.t");
+test_file_contents($contents, "$t/input.t");
 
 $contents = $io->scalar;
-test_file_contents($contents, "$testdir/input.t");
+test_file_contents($contents, "$t/input.t");
 
 $contents = join '', $io->getlines;
-test_file_contents($contents, "$testdir/input.t");
+test_file_contents($contents, "$t/input.t");
 
 SKIP: {
     eval {require Tie::File};
-    skip "requires Tie::File", 2	if $@;
+    skip "requires Tie::File", 2 if $@;
 
     $io->rdonly;
     $contents = join '', map "$_\n", @$io;
-    test_file_contents($contents, "$testdir/input.t");
+    test_file_contents($contents, "$t/input.t");
     $io->close;
 
     $io->tie;
     $contents = join '', <$io>;
-    test_file_contents($contents, "$testdir/input.t");
+    test_file_contents($contents, "$t/input.t");
 }
 
-my @lines = io("$testdir/input.t")->slurp;
+my @lines = io("$t/input.t")->slurp;
 ok(@lines > 36);
-test_file_contents(join('', @lines), "$testdir/input.t");
+test_file_contents(join('', @lines), "$t/input.t");
 
 my $old_contents = $contents;
-$contents << io("$testdir/input.t");
+$contents << io("$t/input.t");
 is($contents, $old_contents . $old_contents);
 
-is(io("$testdir/input.t") >> $contents, ($old_contents x 3));
+is(io("$t/input.t") >> $contents, ($old_contents x 3));
 
 del_output_dir();
@@ -1,7 +1,5 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+use lib -e 't' ? 't' : 'test';
 use Test::More;
 use IO::All;
 use IO_All_Test;
@@ -1,7 +1,5 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+my $t; use lib ($t = -e 't' ? 't' : 'test');
 use Test::More;
 use IO::All;
 use IO_All_Test;
@@ -9,9 +7,8 @@ use Cwd qw(abs_path);
 
 my $linkname = o_dir() . '/mylink';
 
-my $testdir = dirname(__FILE__);
 my $cwd = abs_path('.');
-eval { symlink("$testdir/mydir", $linkname) or die $! };
+eval { symlink("$t/mydir", $linkname) or die $! };
 
 if ($@ or not -l $linkname) {
     plan skip_all => 'Cannot call symlink on this platform';
@@ -1,7 +1,5 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+use lib -e 't' ? 't' : 'test';
 use IO::All;
 use IO_All_Test;
 
@@ -1,7 +1,5 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+use lib -e 't' ? 't' : 'test';
 use Test::More;
 use IO::All;
 use IO_All_Test;
@@ -1,12 +1,10 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+my $t; use lib ($t = -e 't' ? 't' : 'test');
 use Test::More tests => 4;
 use IO::All;
 use IO_All_Test;
 
-my $filename = f dirname(__FILE__) . '/mydir/file1';
+my $filename = f $t . '/mydir/file1';
 
 my $file = io($filename);
 ok($file->isa('IO::All::File'), 'string passed to io() is returned as a file');
@@ -1,7 +1,5 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+use lib -e 't' ? 't' : 'test';
 use Test::More tests => 14;
 use IO::All;
 
@@ -1,7 +1,5 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+my $t; use lib ($t = -e 't' ? 't' : 'test');
 use Test::More tests => 24;
 use IO_All_Test;
 use IO::All;
@@ -9,22 +7,23 @@ use IO::All;
 unlink(o_dir() . '/overload1');
 unlink(o_dir() . '/overload2');
 unlink(o_dir() . '/overload3');
+unlink(o_dir() . '/tmp/mystuff') if -e o_dir() . '/tmp/mystuff';
+rmdir(o_dir() . '/tmp') if -d o_dir() . '/tmp';;
 
-my $testdir = dirname(__FILE__);
-my $data < io("$testdir/mystuff");
-test_file_contents($data, "$testdir/mystuff");
+my $data < io("$t/mystuff");
+test_file_contents($data, "$t/mystuff");
 my $data1 = $data;
 my $data2 = $data . $data;
-$data << io("$testdir/mystuff");
+$data << io("$t/mystuff");
 is($data, $data2);
-$data < io("$testdir/mystuff");
+$data < io("$t/mystuff");
 is($data, $data1);
 
-io("$testdir/mystuff") > $data;
-test_file_contents($data, "$testdir/mystuff");
-io("$testdir/mystuff") >> $data;
+io("$t/mystuff") > $data;
+test_file_contents($data, "$t/mystuff");
+io("$t/mystuff") >> $data;
 is($data, $data2);
-io("$testdir/mystuff") > $data;
+io("$t/mystuff") > $data;
 is($data, $data1);
 
 $data > io(o_dir() . '/overload1');
@@ -52,31 +51,40 @@ io(o_dir() . '/overload1') >> io(o_dir() . '/overload2');
 test_matching_files(o_dir() . '/overload2', o_dir() . '/overload3');
 test_file_contents($data2, o_dir() . '/overload3');
 
+# io(o_dir() . '/tmp/') < io("$testdir/mystuff");
+# test_file_contents($data1, o_dir() . "/tmp/mystuff");
+# io(o_dir() . '/tmp/') << io("$testdir/mystuff");
+# test_file_contents($data2, o_dir() . "/tmp/mystuff");
+# io("$testdir/mystuff") > io(o_dir() . '/tmp/');
+# test_file_contents($data1, o_dir() . "/tmp/mystuff");
+# io("$testdir/mystuff") >> io(o_dir() . '/tmp/');
+# test_file_contents($data2, o_dir() . "/tmp/mystuff");
+
 is(io('foo') . '', 'foo');
 
-is("@{io $testdir . '/mydir'}",
+is("@{io $t . '/mydir'}",
    flip_slash
-     "$testdir/mydir/dir1 $testdir/mydir/dir2 $testdir/mydir/file1 $testdir/mydir/file2 $testdir/mydir/file3",
+     "$t/mydir/dir1 $t/mydir/dir2 $t/mydir/file1 $t/mydir/file2 $t/mydir/file3",
 );
 
-is(join(' ', sort keys %{io "$testdir/mydir"}),
+is(join(' ', sort keys %{io "$t/mydir"}),
    'dir1 dir2 file1 file2 file3',
 );
 
-is(join(' ', sort map {"$_"} values %{io "$testdir/mydir"}),
+is(join(' ', sort map {"$_"} values %{io "$t/mydir"}),
    flip_slash
-     "$testdir/mydir/dir1 $testdir/mydir/dir2 $testdir/mydir/file1 $testdir/mydir/file2 $testdir/mydir/file3",
+     "$t/mydir/dir1 $t/mydir/dir2 $t/mydir/file1 $t/mydir/file2 $t/mydir/file3",
 );
 
-${io("$testdir/mystuff")} . ${io("$testdir/mystuff")} > io(o_dir() . '/overload1');
+${io("$t/mystuff")} . ${io("$t/mystuff")} > io(o_dir() . '/overload1');
 test_file_contents2(o_dir() . '/overload1', $data2);
 
-${io("$testdir/mystuff")} . "xxx\n" . ${io("$testdir/mystuff")} > io(o_dir() . '/overload1');
-$data < io("$testdir/mystuff");
+${io("$t/mystuff")} . "xxx\n" . ${io("$t/mystuff")} > io(o_dir() . '/overload1');
+$data < io("$t/mystuff");
 my $cat3 = $data . "xxx\n" . $data;
 test_file_contents2(o_dir() . '/overload1', $cat3);
 
-is "" . ${io($testdir)}, $testdir, "scalar overload of directory (for mst)";
+is "" . ${io($t)}, $t, "scalar overload of directory (for mst)";
 
 
 del_output_dir();
@@ -1,7 +1,4 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
 use Test::More tests => 4;
 use IO::All;
 
@@ -1,7 +1,5 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+use lib -e 't' ? 't' : 'test';
 use Test::More tests => 2;
 use IO::All;
 use IO_All_Test;
@@ -1,19 +1,16 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+my $t; use lib ($t = -e 't' ? 't' : 'test');
 use Test::More tests => 1;
 use IO::All;
 use IO_All_Test;
 
-my $testdir = dirname(__FILE__);
-my $io = io("$testdir/println.t");
+my $io = io("$t/println.t");
 my @lines = map {chomp; $_} $io->slurp;
 my $temp = io('?');
 $temp->println(@lines);
 $temp->seek(0, 0);
 my $text = $temp->slurp;
 
-test_file_contents($text, "$testdir/println.t");
+test_file_contents($text, "$t/println.t");
 
 del_output_dir();
@@ -1,13 +1,10 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+my $t; use lib ($t = -e 't' ? 't' : 'test');
 use Test::More tests => 8;
 use IO::All;
 use IO_All_Test;
 
-my $testdir = dirname(__FILE__);
-my $outfile = "$testdir/out.pm";
+my $outfile = "$t/out.pm";
 ok(not -f $outfile);
 my $input = io('lib/IO/All.pm')->open;
 ok(ref $input);
@@ -1,7 +1,5 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+use lib -e 't' ? 't' : 'test';
 use Test::More tests => 2;
 use IO::All;
 use IO_All_Test;
@@ -1,12 +1,9 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+my $t; use lib ($t = -e 't' ? 't' : 'test');
 use Test::More tests => 9;
 use IO::All;
 
-my $testdir = dirname(__FILE__);
-my $io = io("$testdir/mystuff");
+my $io = io("$t/mystuff");
 my $x = 0;
 while (my $line = $io->getline || $io->getline) {
     my $expected = <DATA>;
@@ -1,15 +1,12 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+my $t; use lib ($t = -e 't' ? 't' : 'test');
 use Test::More tests => 2;
 use IO::All;
 use IO_All_Test;
 
-my $testdir = dirname(__FILE__);
-my $io = io("$testdir/scalar.t");
+my $io = io("$t/scalar.t");
 my @list = $io->scalar;
 ok(@list == 1);
-test_file_contents($list[0], "$testdir/scalar.t");
+test_file_contents($list[0], "$t/scalar.t");
 
 del_output_dir();
@@ -1,14 +1,11 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+my $t; use lib ($t = -e 't' ? 't' : 'test');
 use Test::More tests => 1;
 use IO::All;
 use IO_All_Test;
 
-my $testdir = dirname(__FILE__);
 {
-my $string < (io("$testdir/mystuff") > io(o_dir() . '/seek'));
+my $string < (io("$t/mystuff") > io(o_dir() . '/seek'));
 my $io = io(o_dir() . '/seek');
 $io->seek(index($string, 'quite'), 0);
 is($io->getline, "quite enough.\n");
@@ -1,7 +1,5 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+use lib -e 't' ? 't' : 'test';
 use Test::More tests => 4;
 use IO::All;
 use IO_All_Test;
@@ -1,16 +1,13 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+my $t; use lib ($t = -e 't' ? 't' : 'test');
 use Test::More tests => 14;
 use IO::All;
 use IO_All_Test;
 
-my $testdir = dirname(__FILE__);
 my ($dev, $ino, $modes, $nlink, $uid, $gid, $rdev,
-    $size, $atime, $mtime, $ctime, $blksize, $blocks) = stat("$testdir/stat.t");
+    $size, $atime, $mtime, $ctime, $blksize, $blocks) = stat("$t/stat.t");
 
-my $io = io("$testdir/stat.t");
+my $io = io("$t/stat.t");
 is($io->device, $dev);
 is($io->inode, $ino);
 is($io->modes, $modes);
@@ -1,7 +1,5 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+use lib -e 't' ? 't' : 'test';
 use Test::More tests => 1;
 use IO::All;
 use IO_All_Test;
@@ -1,7 +1,5 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+use lib -e 't' ? 't' : 'test';
 use Test::More tests => 7;
 use IO::All;
 
@@ -1,21 +1,18 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+my $t; use lib ($t = -e 't' ? 't' : 'test');
 use Test::More tests => 6;
 use IO::All;
 use IO_All_Test;
 
-my $testdir = dirname(__FILE__);
 # Combine two files into a third
-my $my_stuff = io("$testdir/mystuff")->slurp;
-test_file_contents($my_stuff, "$testdir/mystuff");
-my $more_stuff << io("$testdir/morestuff");
-test_file_contents($more_stuff, "$testdir/morestuff");
-io("$testdir/allstuff")->print($my_stuff, $more_stuff);
-ok(-f "$testdir/allstuff");
-ok(-s "$testdir/allstuff");
-test_file_contents($my_stuff . $more_stuff, "$testdir/allstuff");
-ok(unlink("$testdir/allstuff"));
+my $my_stuff = io("$t/mystuff")->slurp;
+test_file_contents($my_stuff, "$t/mystuff");
+my $more_stuff << io("$t/morestuff");
+test_file_contents($more_stuff, "$t/morestuff");
+io("$t/allstuff")->print($my_stuff, $more_stuff);
+ok(-f "$t/allstuff");
+ok(-s "$t/allstuff");
+test_file_contents($my_stuff . $more_stuff, "$t/allstuff");
+ok(unlink("$t/allstuff"));
 
 del_output_dir();
@@ -1,14 +1,11 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+my $t; use lib ($t = -e 't' ? 't' : 'test');
 use Test::More tests => 10;
 use IO::All;
 use IO_All_Test;
 
-my $testdir = dirname(__FILE__);
 # Print name and first line of all files in a directory
-my $dir = io("$testdir/mydir");
+my $dir = io("$t/mydir");
 ok($dir->is_dir);
 my @results;
 while (my $io = $dir->next) {
@@ -26,7 +23,7 @@ for my $line (sort @results) {
 # Print name of all files recursively
 for (
     sort {$a->name cmp $b->name}
-    grep {! /CVS|\.svn/} io("$testdir/mydir")->all_files(0)
+    grep {! /CVS|\.svn/} io("$t/mydir")->all_files(0)
 ) {
     my $dataline = <DATA>;
     $dataline =~ s/^t\//test\// if -e 'test';
@@ -1,12 +1,9 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+my $t; use lib ($t = -e 't' ? 't' : 'test');
 use Test::More tests => 3;
 use IO_All_Test;
 use Config;
 
-my $testdir = dirname(__FILE__);
 sub fix {
     local $_ = shift;
     if ($^O eq 'MSWin32') {
@@ -20,9 +17,9 @@ undef $/;
 # # Copy STDIN to STDOUT
 # io('-')->print(io('-')->slurp);
 my $test1 = fix 'io("-")->print(io("-")->slurp)';
-open TEST, '-|', qq{$^X -Ilib -MIO::All -e $test1 < $testdir/mystuff}
+open TEST, '-|', qq{$^X -Ilib -MIO::All -e $test1 < $t/mystuff}
   or die "open failed: $!";
-test_file_contents(<TEST>, "$testdir/mystuff");
+test_file_contents(<TEST>, "$t/mystuff");
 close TEST;
 
 # # Copy STDIN to STDOUT a block at a time
@@ -31,9 +28,9 @@ close TEST;
 # $stdout->buffer($stdin->buffer);
 # $stdout->write while $stdin->read;
 my $test2 = fix 'my $stdin = io("-");my $stdout = io("-");$stdout->buffer($stdin->buffer);$stdout->write while $stdin->read';
-open TEST, '-|', qq{$^X -Ilib -MIO::All -e $test2 < $testdir/mystuff}
+open TEST, '-|', qq{$^X -Ilib -MIO::All -e $test2 < $t/mystuff}
   or die "open failed: $!";
-test_file_contents(<TEST>, "$testdir/mystuff");
+test_file_contents(<TEST>, "$t/mystuff");
 close TEST;
 
 # # Copy STDIN to a String File one line at a time
@@ -43,9 +40,9 @@ close TEST;
 #     $string_out->print($line);
 # }
 my $test3 = fix 'my $stdin = io("-");my $string_out = io(q{$});while (my $line = $stdin->getline("")) {$string_out->print($line)} print ${$string_out->string_ref}';
-open TEST, '-|', qq{$^X -Ilib -MIO::All -e $test3 < $testdir/mystuff}
+open TEST, '-|', qq{$^X -Ilib -MIO::All -e $test3 < $t/mystuff}
   or die "open failed: $!";
-test_file_contents(<TEST>, "$testdir/mystuff");
+test_file_contents(<TEST>, "$t/mystuff");
 close TEST;
 
 del_output_dir();
@@ -1,13 +1,10 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+my $t; use lib ($t = -e 't' ? 't' : 'test');
 use Test::More tests => 3;
 use IO::All;
 
-my $testdir = dirname(__FILE__);
 # Write some data to a temporary file and retrieve all the paragraphs.
-my $data = io("$testdir/synopsis5.t")->slurp;
+my $data = io("$t/synopsis5.t")->slurp;
 
 my $temp = io->temp;
 ok($temp->print($data));
@@ -1,2 +1,2 @@
-We are noticing that our Big5 greeting --- 
+We are noticing that our Big5 greeting ---
 §A¦n, §ڬO¨©º¸¹êÅç«Ǫº¤¤¤å»y­µ¦X¦¨¨t²Î --- is being garbled in
@@ -1,2 +1,2 @@
-We are noticing that our Big5 greeting --- 
+We are noticing that our Big5 greeting ---
 你好, 我是貝爾實驗室的中文語音合成系統 --- is being garbled in
@@ -1,16 +1,13 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+my $t; use lib ($t = -e 't' ? 't' : 'test');
 use Test::More tests => 1;
 use IO::All;
 use IO_All_Test;
 
-my $testdir = dirname(__FILE__);
 {
-my $io = io("$testdir/tie.t")->tie;
+my $io = io("$t/tie.t")->tie;
 my $file = join '', <$io>;
-test_file_contents($file, "$testdir/tie.t");
+test_file_contents($file, "$t/tie.t");
 
 my $io1 = io(o_dir() . '/tie.t')->tie;
 print $io1 "test";
@@ -1,19 +1,16 @@
-use strict;
-use warnings;
-use File::Basename;
-use lib dirname(__FILE__);
+use strict; use warnings;
+my $t; use lib ($t = -e 't' ? 't' : 'test');
 use Test::More;
 use IO_All_Test;
 use IO::All;
 
-my $testdir = dirname(__FILE__);
 plan((eval {require Tie::File; 1})
     ? (tests => 2)
     : (skip_all => "requires Tie::File")
 );
 
 {
-(io(o_dir() . '/tie_file1') < io("$testdir/tie_file.t"))->close;
+(io(o_dir() . '/tie_file1') < io("$t/tie_file.t"))->close;
 my $file = io(o_dir() . '/tie_file1')->rdonly;
 is($file->[-1], 'bar');
 is($file->[-2], 'foo');