Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^3: Strawberry CPAN.pm wrongly overrides INC in Makefile.PL

by Anonymous Monk
on Sep 30, 2008 at 07:50 UTC ( [id://714490]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Strawberry CPAN.pm wrongly overrides INC in Makefile.PL
in thread Strawberry CPAN.pm wrongly overrides INC in Makefile.PL

Personally, I used the "I'm staying at Schwern's place and asked him" form of the documentation. So perhaps it's an unofficially-supported feature...

One of the long-standings problems with the Makefile.PL command line invocation is that it's really an API, but nobody has formalised it or told anyone.

There's a long-standing assumption by the CPAN clients that you can just pass in the same params to everything (which is why that CPAN/Config.pm setting exists) and a long-standing assumption by module authors that you can ask the user to provide you anything you like as a param to Makefile.PL.

The former is actually the more-correct, since in the general case there IS no user to read your docs and type stuff into Makefile.PL. And any module that HAS to have a user type in stuff is more of less incompatible with the CPAN.

I believe one of Schwern's "improving the CPAN" tasks was to try and properly codify the Makefile.PL "API".
  • Comment on Re^3: Strawberry CPAN.pm wrongly overrides INC in Makefile.PL

Replies are listed 'Best First'.
Re^4: Strawberry CPAN.pm wrongly overrides INC in Makefile.PL
by mje (Curate) on Sep 30, 2008 at 09:18 UTC
    Anonymous Monk said:
    long-standing assumption by module authors that you can ask the user to provide you anything you like as a param to Makefile.PL

    I have not made that assumption. I have gone out of my way to make my modules work without FAILs from cpan-testers, via cpan shell, from the command line and the module in question:

    • uses prompt which does not prompt when doing automated smoking like cpan-testers do and fall back to a decent default.
    • goes out of its way to ensure cpan knows what the requirements are - setting build_requires, configure_requires in META (although it would seem few people have a cpan that understands these yet). They set PREREQ_PM in ExtUtils::MakeMaker. All so cpan knows what the dependencies are and automated smokers don't baulk and FAIL it.
    • instead of asking whether DBI is installed and where the DBI header file can be found they use a method supplied with DBI to return the header file name and location. They then set this into INC but this is where it all goes wrong in strawberry perl and it also causes a major problem needing to ensure DBI is present before calling a method in DBI but having to do this after PREREQ_PM is acted on.
    • defaults to the most common configuration for the platform you are building on but supports overrides for anyone wanting anything not so usual.
    • understands that for some people they may be installing the module before having installed an ODBC driver and the tests don't baulk on this.

    Between trying to avoid FAIL reports via cpan-testers, keeping up with non-compatible changes in ExtUtils::MakeMaker and supporting distributions that work differently (like strawberry perl) I'm guessing some module authors are living in a world of pain and certainly I seem to be spending more time tweaking things back and forth in the installations instead of adding all those requested features the users of the module want.

    All I want in this case is to add a path to INC (without it my module will not even build - it is XS and needs DBI header files). It would appear for the current version of ExtUtils::MakeMaker and strawberry perl the only automatic thing I can do is delete INC from ARGV which seems a little drastic. The user on the other hand can either a) install manually b) edit makepl_arg in cpan c) edit Makefile after generation. For now I'm looking for INC in ARGV, outputting a message saying it will not work with advice on fixing it and, oh yes, remembering to exit 0 without creating a Makefile or cpan testers will issue a FAIL.

      The new version of Strawberry should resolve your issue

        Thank you

        I forgot to report back here but in the mean time I was given the following patch to DBD::ODBC which I know was also applied to a few other DBDs:

        package MY; use strict; use Config; sub constants { my $self = shift; require DBI::DBD; # The problem with stawberry perl is it sets INC on the command li +ne # and that overrides INC in this Makefile unless we set it here. my $old_constants = $self->SUPER::constants(); my $new_constants; foreach my $line ( split(/\n/, $old_constants) ) { if ( $line =~ /^INC = .*strawberry.*/ ) { print qq(Strawberry Perl found; adjusting the INC variable +;\n); $line = $line . q( -I) . DBI::DBD::dbd_dbi_arch_dir(); print qq(INC is now $line\n); } $new_constants .= $line . qq(\n); } return $new_constants; }

        Could you tell me in what version of strawberry perl I will be able to remove the above?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2024-04-23 09:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found