niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Not Unix » VMS » vmsperl
Extension naming & loading in Perl 5.8.7
Post new topic   Reply to topic Page 1 of 1 [6 Posts] View previous topic :: View next topic
Author Message
Jeremy Begg
*nix forums addict


Joined: 13 Jul 2005
Posts: 84

PostPosted: Tue Aug 16, 2005 1:21 am    Post subject: Extension naming & loading in Perl 5.8.7 Reply with quote

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:

Quote:
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: jeremy@vsm.com.au |
| South Australia 5081 | Phone: +61 8 8221 5188 |
|---------------------------| Mobile: 0414 422 947 |
| A.C.N. 068 409 156 | FAX: +61 8 8221 7199 |
+---------------------------------------------------------+
Back to top
Michael G Schwern
*nix forums beginner


Joined: 08 Jul 2005
Posts: 27

PostPosted: Tue Aug 16, 2005 4:21 am    Post subject: Re: Extension naming & loading in Perl 5.8.7 Reply with quote

On Tue, Aug 16, 2005 at 12:39:00PM +0930, Jeremy Begg wrote:
Quote:
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?

On every operating system but VMS that assumption is pretty safe. Since
most non-VMS folks are not aware of the existance of non-case preserving
filesystems (except maybe DOS) they tend not to code for them.

The discovery technique used in Module::Install is pretty much doomed on a
non-case preserving FS. This has come up before and was brought to the
author's attention (ie. Autrijus). I'm not sure what came of it. Two work
arounds come to mind. Look for /^package ($module_name)/i in the files in
question in order to get the correct case. Or it can use the MANIFEST to
correct case.


--
Michael G Schwern schwern@pobox.com http://www.pobox.com/~schwern
I do have a cause though. It's obscenity. I'm for it.
- Tom Lehrer
Back to top
John E. Malmberg
*nix forums Guru Wannabe


Joined: 30 May 2005
Posts: 264

PostPosted: Tue Aug 16, 2005 12:54 pm    Post subject: Re: Extension naming & loading in Perl 5.8.7 Reply with quote

Michael G Schwern wrote:
Quote:
On Tue, Aug 16, 2005 at 12:39:00PM +0930, Jeremy Begg wrote:

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?

On every operating system but VMS that assumption is pretty safe. Since
most non-VMS folks are not aware of the existance of non-case preserving
filesystems (except maybe DOS) they tend not to code for them.

The discovery technique used in Module::Install is pretty much doomed on a
non-case preserving FS. This has come up before and was brought to the
author's attention (ie. Autrijus). I'm not sure what came of it. Two work
arounds come to mind. Look for /^package ($module_name)/i in the files in
question in order to get the correct case. Or it can use the MANIFEST to
correct case.

Well, I am trying to get the VMS case preserving mode into blead-perl.

I have it working on my local copy of Perl 5.8.7.

There is another issue though. The tools that unpack the archives may
not always preserve the case.

-John
wb8tyw@qsl.net
Personal Opinion Only
Back to top
Craig A. Berry
*nix forums Guru Wannabe


Joined: 27 May 2005
Posts: 143

PostPosted: Tue Aug 16, 2005 2:00 pm    Post subject: Re: Extension naming & loading in Perl 5.8.7 Reply with quote

On Tuesday, August 16, 2005, at 01:22AM, Michael G Schwern <schwern@pobox.com> wrote:

Quote:
On Tue, Aug 16, 2005 at 12:39:00PM +0930, Jeremy Begg wrote:
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?

On every operating system but VMS that assumption is pretty safe. Since
most non-VMS folks are not aware of the existance of non-case preserving
filesystems (except maybe DOS) they tend not to code for them.

The discovery technique used in Module::Install is pretty much doomed on a
non-case preserving FS. This has come up before and was brought to the
author's attention (ie. Autrijus). I'm not sure what came of it.

I submitted a patch that got things working, see

http://www.xray.mpe.mpg.de/mailing-lists/vmsperl/2005-03/msg00071.html

but never received a reply from the author.
Back to top
Michael G Schwern
*nix forums beginner


Joined: 08 Jul 2005
Posts: 27

PostPosted: Tue Aug 16, 2005 4:07 pm    Post subject: Re: Extension naming & loading in Perl 5.8.7 Reply with quote

On Tue, Aug 16, 2005 at 11:00:01AM -0500, Craig Berry wrote:
Quote:
I submitted a patch that got things working, see

http://www.xray.mpe.mpg.de/mailing-lists/vmsperl/2005-03/msg00071.html

but never received a reply from the author.

Autrijus probably just dropped it on the floor. I've attached a note to
rt.cpan.org 11169 so at least he won't lose it again.
http://rt.cpan.org/NoAuth/Bug.html?id=11169


--
Michael G Schwern schwern@pobox.com http://www.pobox.com/~schwern
Don't try the paranormal until you know what's normal.
-- "Lords and Ladies" by Terry Prachett
Back to top
Jeremy Begg
*nix forums addict


Joined: 13 Jul 2005
Posts: 84

PostPosted: Tue Aug 16, 2005 10:28 pm    Post subject: Re: Extension naming & loading in Perl 5.8.7 Reply with quote

Hi,

Thanks to all of you for your comments and assistance. FWIW I did get the
modules built. Convert::ASN1 and Net::LDAP were the two supplied by Graham
Barr and both had the same problem. I fixed it by editing the 'package' and
'use' statements in every affected .PM file (about a dozen or so in total).

(Graham's modules also had another problem, one of his own making, in that
his Makefile.PL modifies the makefile producued by MakeMaker. Unfortunately
his code assumed that the makefile was called 'Makefile'. Changing it to
look for DESCRIP.MMS fixed that problem.)

Quote:
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?

On every operating system but VMS that assumption is pretty safe. Since
most non-VMS folks are not aware of the existance of non-case preserving
filesystems (except maybe DOS) they tend not to code for them.

The discovery technique used in Module::Install is pretty much doomed on a
non-case preserving FS. This has come up before and was brought to the
author's attention (ie. Autrijus). I'm not sure what came of it. Two work
arounds come to mind. Look for /^package ($module_name)/i in the files in
question in order to get the correct case. Or it can use the MANIFEST to
correct case.

Well, I am trying to get the VMS case preserving mode into blead-perl.

I have it working on my local copy of Perl 5.8.7.

I've noticed your comments on this subject in recent weeks. I'm not really
in a position to be able to contribute to that level of detail I'm afraid,
and your efforts are (will be?) very much appreciated.

Quote:
There is another issue though. The tools that unpack the archives may
not always preserve the case.

I wondered about that, so I used the LDDRIVER to set up a 100MB container
file formatted as an ODS-5 disk. VMSTAR preserved the original case so
that's promising for other CPAN modules. The only potential problem I could
see is where filenames have extra '.' characters, leading VMS to prefix them
with a ^. Hopefully the Perl internals you've been working on will handle
this.

Regards,

Jeremy Begg

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

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [6 Posts] View previous topic :: View next topic
The time now is Fri Jan 09, 2009 8:24 am | All times are GMT
navigation Forum index » Not Unix » VMS » vmsperl
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Need Help with Program in Perl on a Netware Server fhadzocos@gmail.com Perl 3 Fri Jul 21, 2006 1:57 pm
No new posts problems using oddmuse with mod_perl2 inside apache2.2 pe... Fergus McMenemie Perl 0 Fri Jul 21, 2006 9:48 am
No new posts Problem with Win32-SerialPort over bluetooth @ windows + ... ctloh Perl 0 Fri Jul 21, 2006 8:08 am
No new posts Posting Guidelines for comp.lang.perl.misc (: 1.... Tad McClellan Perl 0 Fri Jul 21, 2006 7:22 am
No new posts Perl Help - easy one Marc Perkel Exim 2 Fri Jul 21, 2006 5:54 am

Fish Tank Help | Debt Consolidation | Debt Consolidation | Credit Cards | Mortgages
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1942s ][ Queries: 16 (0.0807s) ][ GZIP on - Debug on ]