[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dh_perl



On Sat, Feb 01, 2003 at 04:02:53PM -0500, Joey Hess wrote:
>Henrique de Moraes Holschuh wrote:
>> Is there a reason why we don't have something like a shlibs file for perl?
>> It *would* come in handy, and tools such as dh_perl could make use of it.
>
>I've been kicking the idea around for a while, I think it is a
>reasonable idea, and we could possibly even shoehorn it into the shlibs
>files. I don't have anything concrete though.

While a basic grep for (use|require) would give a reasonable first cut
approximation, it's not really possible to do this properly--consider
this fragment from the IO module:

  sub import {
      shift;
      my @l = @_ ? @_ : qw(Handle Seekable File Pipe Socket Dir);

      eval join("", map { "require IO::" . (/(\w+)/)[0] . ";\n" } @l)
	  or croak $@;
  }

or this from Term::ReadLine:

  my ($which) = exists $ENV{PERL_RL} ? split /\s+/, $ENV{PERL_RL} : undef;
  if ($which) {
    if ($which =~ /\bgnu\b/i){
      eval "use Term::ReadLine::Gnu;";
    } elsif ($which =~ /\bperl\b/i) {
      eval "use Term::ReadLine::Perl;";
    } else {
      eval "use Term::ReadLine::$which;";
    }
  } elsif (defined $which and $which ne '') {	# Defined but false
    # Do nothing fancy
  } else {
    eval "use Term::ReadLine::Gnu; 1" or eval "use Term::ReadLine::Perl; 1";
  }

As you can see from these examples, even executing the code (and
presumably grepping the output for /usr/(lib|share)/perl5) doesn't
necessarily help, as the modules included will differ depending on the
arguments/environment given.

What may be a more promising approach would be looking for a PREREQ_PM
given in the Makefile.PL.

--bod



Reply to: