Hi,

Last week I asked for help building Convert::ASN1 on Perl 5.8.7, which was
failing as follows:

     $ sh def
       DKA100:[SOURCES.CONVERT-ASN1-0_19]
     $ perl makefile.pl
     Can't locate object method "new" via package "Module::Install::base"
      (perhaps you forgot to load "Module::Install::base"?)
      at inc/Module/Install.pm - /Users/gbarr/Library/Perl/Module/Install.pm 
line 269.
     %SYSTEM-F-ABORT, abort
     $

I received one response which led me to write directly to the author of that
module (Graham Barr).  He in turn suggested that:

>My modules do use MakeMaker, it is just that Module::Install
>provides a wrapper over it which makes writing the MakeFile.PL
>a lot easier.
>
>It is suspect to me that your error is reporting ::base (lower case)
>but the package and file are actually uppercase.
>
>This maybe something to do with find_extensions in inc/Module/Install.pm
>but I am unfamiliar with VMS
>
>Graham.

So I added some tracewrites to his Install.PM module which produced the
following:

   $ perl makefile.pl
   In load_extensions() ...
   In find_extensions() ...

      find_extensions found file inc/Module/Install

      find_extensions found file inc/Module/Install/base.pm
      find_extensions self->{path}file is Module/Install/base.pm
      find_extensions package is Module::Install::base

      find_extensions found file inc/Module/Install/can.pm
      find_extensions self->{path}file is Module/Install/can.pm
      find_extensions package is Module::Install::can

      find_extensions found file inc/Module/Install/fetch.pm
      find_extensions self->{path}file is Module/Install/fetch.pm
      find_extensions package is Module::Install::fetch

      find_extensions found file inc/Module/Install/include.pm
      find_extensions self->{path}file is Module/Install/include.pm
      find_extensions package is Module::Install::include

      find_extensions found file inc/Module/Install/makefile.pm
      find_extensions self->{path}file is Module/Install/makefile.pm
      find_extensions package is Module::Install::makefile

      find_extensions found file inc/Module/Install/metadata.pm
      find_extensions self->{path}file is Module/Install/metadata.pm
      find_extensions package is Module::Install::metadata

      find_extensions found file inc/Module/Install/win32.pm
      find_extensions self->{path}file is Module/Install/win32.pm
      find_extensions package is Module::Install::win32

    load_extensions: loading package Module::Install::base from file 
Module/Install/base.pm
    load_extensions: require Module/Install/base.pm worked
   Can't locate object method "new" via package "Module::Install::base"
    (perhaps you forgot to load "Module::Install::base"?)
    at inc/Module/Install.pm - /Users/gbarr/Library/Perl/Module/Install.pm line 
271.
   %SYSTEM-F-ABORT, abort

You'll notice the tracewrites and error message all refer to
"Module/Install/base.pm" and "Module::Install::base", i.e. the 'base' is
lowercase.

Graham's comments about upper/lower case issues got me thinking and so I had
a look at BASE.PM wherein I found this at the top of the file:

   package Module::Install::Base;

I edited this to read

   package Module::Install::base;

i.e. so that the capitalisation matches my tracewrites and the error
message.  The next build made more progress:

   .
   .
   .
    load_extensions: loading package Module::Install::base from file 
Module/Install/base.pm
    load_extensions: require Module/Install/base.pm worked

    load_extensions: loading package Module::Install::can from file 
Module/Install/can.pm
    load_extensions: require Module/Install/can.pm worked
   Can't locate object method "new" via package "Module::Install::can"
    (perhaps you forgot to load "Module::Install::can"?)
    at inc/Module/Install.pm - /Users/gbarr/Library/Perl/Module/Install.pm line 
271.
   %SYSTEM-F-ABORT, abort

So now it's failing on 'can.pm' which of course has this at the top:

   package Module::Install::Can;


These modules are loaded using this code from Install.PM:

sub load_extensions {
    my ($self, $path, $top_obj) = @_;

print "In load_extensions() ...\n";
    unshift @INC, $self->{prefix}
        unless grep { $_ eq $self->{prefix} } @INC;

    local @INC = ($path, @INC);
    foreach my $rv ($self->find_extensions($path)) {
        my ($file, $pkg) = @{$rv};
        next if $self->{pathnames}{$pkg};
print "\n load_extensions: loading package $pkg from file $file\n";
        eval { require $file; 1 } or (warn($@), next);
print " load_extensions: require $file worked\n";
        $self->{pathnames}{$pkg} = delete $INC{$file};
        push @{$self->{extensions}}, $pkg->new( _top => $top_obj );
    }
print "Load extensions() finished\n";
}

sub find_extensions {
    my ($self, $path) = @_;
    my @found;

print "In find_extensions() ...\n";

    File::Find::find(sub {
        my $file = $File::Find::name;
print "\n   find_extensions found file $file\n";
        return unless $file =~ m!^\Q$path\E/(.+)\.pm\Z!is;
        return if $1 eq $self->{dispatch};

        $file = "$self->{path}/$1.pm";
print "   find_extensions self->{path}file is $file\n";
        my $pkg = "$self->{name}::$1"; $pkg =~ s!/!::!g;
print "   find_extensions package is $pkg\n";
        push @found, [$file, $pkg];
    }, $path) if -d $path;

    @found;
}


(The print statements are my tracewrites.)

Where exactly is the problem here?  It looks like Install.PM is assuming the
case of the filenames returned by File::Find is going to match the package
names declared in those files, but is that improper behaviour?

Thanks,

        Jeremy Begg

  +---------------------------------------------------------+
  |            VSM Software Services Pty. Ltd.              |
  |                 http://www.vsm.com.au/                  |
  |       "OpenVMS Systems Management & Programming"        |
  |---------------------------------------------------------|
  | P.O.Box 402, Walkerville, |  E-Mail:  [EMAIL PROTECTED] |
  | South Australia 5081      |   Phone:  +61 8 8221 5188   |
  |---------------------------|  Mobile:  0414 422 947      |
  |  A.C.N. 068 409 156       |     FAX:  +61 8 8221 7199   |
  +---------------------------------------------------------+

Reply via email to