Subject: | [PATCH] Makefile.PL protability suggestion |
In my environment the Makefile.PL fails because it doesn't find yapp
although Parse::Yapp is installed.
May I suggest to replace the requires_external_bin line and calculate
the path to yapp manually?
This ensures that the perl that builds the Module and the one that tests
it are the same. And it helps to find our own yapp even if not in the path.
I've left the fallback to the requires_external_bin line in in case we
find no yapp in the expected directory.
The configure_requires promises that the yapp already is there when
Makefile.PL is executed because installers are bound to read the META.yml.
What do you think?
Here is the patch:
--- Makefile.PL~ 2008-04-10 00:37:39.000000000 +0200
+++ Makefile.PL 2008-04-15 05:00:18.000000000 +0200
@@ -1,19 +1,27 @@
use inc::Module::Install;
+use Config;
+use File::Spec;
+
name('Data-SExpression');
license('Perl');
version_from('lib/Data/SExpression.pm');
requires('Class::Accessor::Fast');
-requires('Parse::Yapp');
+configure_requires('Parse::Yapp');
build_requires('Test::More');
build_requires('Test::Deep');
-requires_external_bin('yapp');
+#
+my $yapp = File::Spec->catfile($Config{scriptdirexp},"yapp");
+unless (-e $yapp) {
+ requires_external_bin('yapp');
+ $yapp = "yapp";
+}
-system('yapp -m Data::SExpression::Parser -o
lib/Data/SExpression/Parser.pm lib/Data/SExpression/Parser.yp')
+system("$yapp -m Data::SExpression::Parser -o
lib/Data/SExpression/Parser.pm lib/Data/SExpression/Parser.yp")
and die("Failed: Unable to create Data::SExpression::Parser (Is
Parse::Yapp appropriately installed on your system?)");
WriteAll;
Thanks,