--- /dev/null
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use File::Find;
+use File::Slurp 'slurp';
+use List::MoreUtils 'uniq';
+
+unlink 'lib/Mouse/Tiny.pm';
+
+my @files;
+
+find({
+ wanted => sub { push @files, $_ if -f $_ && !/Squirrel/ },
+ no_chdir => 1,
+}, 'lib');
+
+my $mouse_tiny = '';
+
+for my $file (uniq 'lib/Mouse/Util.pm', sort @files) {
+ my $contents = slurp $file;
+
+ $contents =~ s/__END__\b.*//s; # remove documentation
+ $contents =~ s/1;\n*$//; # remove success indicator
+ $contents =~ s/^.*\n//; # remove shebang
+
+ $contents =~ s/^use Mouse\S*\s*\n//mg; # we're already loading everything
+ $contents =~ s/^use (Mouse\S*)\s*(.+);/BEGIN { $1->import($2) }/mg;
+
+ $mouse_tiny .= $contents;
+}
+
+$mouse_tiny .= << 'EOF';
+package Mouse::Tiny;
+use base 'Mouse';
+
+EOF
+
+open my $handle, '>lib/Mouse/Tiny.pm' or die "Can't write lib/Mouse/Tiny.pm: $!";
+
+print { $handle } << 'EOF';
+#!/usr/bin/env perl
+# THIS FILE IS AUTOGENERATED!
+
+# if regular Mouse is loaded, bail out
+# XXX: TODO
+
+# tell Perl we already have all of the Mouse files loaded:
+EOF
+
+for my $file (@files) {
+ (my $inc = $file) =~ s{^lib/}{};
+ print { $handle } "\$INC{'$inc'} = __FILE__;\n";
+}
+
+print { $handle } "\n# and now their contents\n\n";
+
+print { $handle } $mouse_tiny;
+print { $handle } "1;\n\n";
+