Improved tests and documentation. Fixed a few bugs in register()
[p5sagit/Excel-Template.git] / Makefile.PL
index a7aefc3..db972f0 100644 (file)
@@ -1,84 +1,43 @@
-use ExtUtils::MakeMaker;
-# See lib/ExtUtils/MakeMaker.pm for details of how to influence
-# the contents of the Makefile that is written.
+use strict;
 
-use File::Spec;
+use ExtUtils::MakeMaker;
+{
+    no strict 'refs';
+
+    my $libscan = \&{"ExtUtils::MM_Any::libscan"};
+    *{"ExtUtils::MM_Any::libscan"} = sub {
+        return '' unless $libscan->(@_);
+        return '' if $_[1] =~ /\.swp$/;
+        return $_[1];
+    };
+}
 
 my $prereqs = {
-    'Test::Simple'            => 0.44,
+    'Spreadsheet::WriteExcel' => 0.42,
+    'Test::More'              => 0.01,
     'XML::Parser'             => 0.01,
-    'IO::File'                => 0.01,
     'IO::Scalar'              => 0.01,
     'File::Basename'          => 0.01,
-    'Spreadsheet::WriteExcel' => 0.42,
 };
 
-# The assumption is the 5.8.0 and greater doesn't need Unicode::String.
+# The assumption is Perl 5.8.0 and greater doesn't need Unicode::String.
+
 if ($] < 5.008)
 {
-    print "Do you want Unicode support? ";
-    my $answer = <STDIN>;
-    my $need_unicode = $answer =~ /^[Yy]/;
-
-    my $use_unicode = 0;
-    if ($need_unicode)
+    eval { require Unicode::String; };
+    if ($@)
     {
-            $prereqs{'Unicode::String'} = '0.01';
-            $use_unicode = 1;
+        print "Note: If you want to work with Unicode, you will need to install";
+        print "the optional module Unicode::String and set USE_UNICODE to true.";
     }
 }
 
-use_unicode($use_unicode);
-
 WriteMakefile(
     NAME         => 'Excel::Template',
     VERSION_FROM => 'lib/Excel/Template.pm', # finds $VERSION
-    AUTHOR       => 'Rob Kinyon (rob.kinyon@gmail.com)',
     ABSTRACT     => 'Excel::Template',
     PREREQ_PM    => $prereqs,
+    ($] >= 5.005 ?
+       (ABSTRACT_FROM => 'lib/Excel/Template.pm',
+        AUTHOR       => 'Rob Kinyon (rob.kinyon@gmail.com)') : ()),
 );
-
-sub use_unicode
-{
-    my $using_unicode = shift;
-
-    my @filenames = map {
-        File::Spec->catfile(
-            qw( lib Excel Template ),
-            @{$_},
-        )
-    } ( [ qw( Element Cell.pm_ ) ], [ qw( TextObject.pm_ ) ] );
-
-    foreach my $filename (@filenames)
-    {
-        open(IN_FILE, $filename)
-            or die "Cannot open '$filename' for reading: $!\n";
-        my @lines = <IN_FILE>;
-        close(IN_FILE);
-
-        if ($using_unicode)
-        {
-            for (@lines)
-            {
-                s/^UNI_YES / /;
-                s/^UNI_NO  /#/;
-            }
-        }
-        else
-        {
-            for (@lines)
-            {
-                s/^UNI_YES /#/;
-                s/^UNI_NO  / /;
-            }
-        }
-
-        $filename =~ s/_$//;
-        open(OUT_FILE, ">$filename")
-            or die "Cannot open '$filename' for writing: $!\n";
-        print OUT_FILE @lines;
-        close(OUT_FILE);
-    }
-
-    return 1;
-}