$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';
# THIS FILE IS AUTOGENERATED!
# if regular Mouse is loaded, bail out
-# XXX: TODO
+unless ($INC{'Mouse.pm'}) {
+eval q{
# tell Perl we already have all of the Mouse files loaded:
EOF
print { $handle } "\n# and now their contents\n\n";
print { $handle } $mouse_tiny;
+
+print { $handle } "}; #eval\n} #unless\n\n";
+
+print { $handle } << 'EOF';
+package Mouse::Tiny;
+use base 'Mouse';
+
+EOF
+
print { $handle } "1;\n\n";