Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Bootstrapping Makefile.PL with Apache::Bootstrap

by redhotpenguin (Deacon)
on Apr 28, 2009 at 05:57 UTC ( [id://760516]=perlquestion: print w/replies, xml ) Need Help??

redhotpenguin has asked for the wisdom of the Perl Monks concerning the following question:

This is my latest attempt at a Makefile.PL section that invokes Apache::Bootstrap or exits with exit code 255. The intent is that if Apache::Bootstrap is not installed, the Makefile.PL dies with code 255, the same error number returned to the shell as if 'use 5.8.8;' failed in Makefile.PL.

I'm mainly looking for feedback on this code. The reasons that I need to do what I'm doing may not be all that clear, but I need to use either ExtUtils::MakeMaker or ModPerl::Build::MM, and that depends on the versions of mod_perl (if any) that are installed.

#!/usr/bin/perl use strict; use warnings; ################################### # minimum version of A::B required my $ab = 0.06; eval { require Apache::Bootstrap }; ($@ or ($Apache::Bootstrap::VERSION < $ab)) && do { $! = 255; die("Apache::Bootstrap $ab required"); }; # make sure we have at least one minimum version of mod_perl my $bs = eval { Apache::Bootstrap->new({ mod_perl2 => 1.99022, mod_perl => 1.30 }) }; do { $! = 255; die($@); } if $@; ################################################# # use $bs to determine whether ExtUtils::MakeMaker # or ModPerl::Build::MM should be used to write # the Makefile

Replies are listed 'Best First'.
Re: Bootstrapping Makefile.PL with Apache::Bootstrap
by Anonymous Monk on Apr 28, 2009 at 06:33 UTC
    Only a non-zero exit code is necessary, so I would write
    my $ab = 0.06; eval { require Apache::Bootstrap; Apache::Bootstrap->VERSION($ab); 1 } or die "Apache::Bootstrap $ab required"; my $bs = Apache::Bootstrap->new({ mod_perl2 => 1.99022, mod_perl => 1.30 });
    Actually I would just write use Apache::Bootstrap 0.06;?

      I started with 'use Apache::Bootstrap 0.06;', but that caused an UNKNOWN cpan testers failure, with the error "Can't locate Apache::Bootstrap...". So I checked the error number passed back to the shell for that failure and it was 1.

      I checked the error number passed to the shell for 'use 5.8.6;' pragma in a Makefile.PL that didn't have that version of perl, and the error number was 255. My theory is that Test::Harness or something is picking up that error code differently, since these occurrences are represented in CPAN tester reports as NA.

        I think that is not recommended:
        "Why am I getting a FAIL/UNKNOWN/NA report when prerequisites are not met?"

        Some early versions of CPAN Testers tools had bugs that did not properly catch when prerequisites were specified but not met. Please just ignore these reports.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://760516]
Approved by planetscape
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (9)
As of 2024-03-28 10:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found