#4 Makefile.PL using eval to check optional deps causes failure


There was a change to get_meta from 2.021 to 2.022 in
how it handles exceptions when running Makefile.PL to
extract the metadata. However, it causes many packages
to be completely unbuildable. DBI is a good example.
Its Makefile.PL performs a check like this for an
optional dependency:

eval "use RPC::PlServer 0.2001 ();";
if ($@) {
push @missing, 'RPC::PlServer';
print "\a",<<'MSG';
*** Note:
The optional PlRPC-modules (RPC::PlServer etc) are
not installed.
If you want to use the DBD::Proxy driver and
modules, then you'll need to install the
RPC::PlServer, RPC::PlClient,
Storable and Net::Daemon modules. The CPAN
Bundle::DBI may help you.
You can install them any time after installing the DBI.
You do *not* need these modules for typical DBI usage.

sleep 2;

The problem is this section of code:

# no input or output
# execute the makefile
my $crash = "";
if (1) {
local $SIG{__DIE__} = sub { $crash = $_[0]; die
@_; };
do $t;
# clean up
unlink $t || die "get_meta(): rm[$t] - $!";
if ($crash) {
$crash =~ s/$t/$info{PL}/g;
die "FATAL CRASH! Could not load

You use do to execute the Makefile.PL in this scope.
However, when the eval inside of the Makefile.PL tests
for the optional dependency and fails, your
$SIG{__DIE__} handler picks it up (due to the broken
implementation of $SIG{__DIE__} in the Perl core),
assumes the Makefile.PL has failed, and bails out.

This patch offers a better way.


  • Erick Calder

    Erick Calder - 2004-02-06
    • status: open --> closed-accepted
  • Erick Calder

    Erick Calder - 2004-02-06

    Logged In: YES

    Stephen, thanks for the trouble. I've struggled a lot over the
    issue of how to get stuff from the .PL files and I seem to
    recall some problem with executing the do inside an eval... I
    just don't remember what it was and can't find it in the
    (huge) cvs logs... so we'll let it stand until something else
    rears its head.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks