From: Shawn M Moore Date: Sun, 28 Sep 2008 19:10:16 +0000 (+0000) Subject: Bail out of Mouse::Tiny if Mouse is loaded -- we already have all the classes X-Git-Tag: 0.19~181 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2da0530eed53d4da7fe95ffa31d5ece586dbade8;p=gitmo%2FMouse.git Bail out of Mouse::Tiny if Mouse is loaded -- we already have all the classes --- diff --git a/generate-mouse-tiny.pl b/generate-mouse-tiny.pl index c4c104a..3110274 100755 --- a/generate-mouse-tiny.pl +++ b/generate-mouse-tiny.pl @@ -29,12 +29,6 @@ for my $file (uniq 'lib/Mouse/Util.pm', sort @files) { $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'; @@ -42,7 +36,8 @@ 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 @@ -55,5 +50,14 @@ for my $file (@files) { 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";