[PATCH] Module::Install 0.36 for VMS (was Re: Module::Install and portability?)
Michael G Schwern wrote: If it has to scan the filesystem to figure out what's in inc/ then there could be problems. A simple work around for non-case preserving file systems might be a patch to Module::Install::Base to peek inside the .pm file for a package statement which matches (case- insensitively) the name of the file and using that to correct the case. I've done something like that in the attached patch, basically cribbing from what AutoInstall does to scan for package names. I tried modifying several places that seemed to be doing something similar to that (to no avail), but I don't understand the code duplication between inc/ and lib/ My guess is Module::Install is deliberately using itself to install itself so as to better eat its own dog food. MakeMaker eats its own dog food, but it doesn't require the maintenance of two versions of the same code. I'm guessing (and hoping) the stuff under inc/ is automatically derived somehow from what's under lib/. The POD is stripped and there are line numbers squirted in, kinda like what xsubpp does when generating C from XS, but heck if I know what the process is or can find anything documented that explains it. So the patch makes the same modifications twice, once under inc/ and once under lib/. This is less than optimal, since it looks like only the inc/ stuff gets tested but only the lib/ stuff (or blib/lib/) gets installed. Here are the changes: 1.) When hacking the internals of a generated Makefile, use the $(NOECHO) macro instead of just '@' and always leave whitespace after it. The whitespace is mandatory on VMS; without it, the '@' is considered part of the command that gets passed to the shell. 2.) Use '_author' instead of '.author' when on VMS since a dot in a directory name is usually invalid and always awkward. 3.) Be case blind when searching @INC for $self-{prefix}. 4.) When finding extensions, obtain case-preserved package names from inside the file when necessary. 5.) When rewriting the guts of a generated Makefile, use MM-{FIRST_MAKEFILE} as the name of the file rather than just 'Makefile', which is highly unlikely to be the correct name on VMS. 6.) When rewriting the guts of a generated Makefile to add -Iinc to all the Perl commands, surround the switch in double quotes to preserve case on the command line. After the patch, Module::Install will build and passes its very minimal test suite using Perl 5.8.4 on OpenVMS Alpha v7.3-1. --- inc/ExtUtils/AutoInstall.pm;-0 Thu Sep 9 10:01:43 2004 +++ inc/ExtUtils/AutoInstall.pm Fri Mar 25 22:53:28 2005 @@ -585,7 +585,7 @@ sub _make_args { $PostambleActions = ( $missing ? \$(PERL) $0 --config=$config --installdeps=$missing - : [EMAIL PROTECTED](NOOP) + : \$(NOECHO) \$(NOOP) ); return %args; @@ -626,7 +626,7 @@ sub postamble { return .; config :: installdeps [EMAIL PROTECTED](NOOP) +\t\$(NOECHO) \$(NOOP) checkdeps :: \t\$(PERL) $0 --checkdeps --- inc/Module/Install.pm;-0Thu Sep 9 10:01:42 2004 +++ inc/Module/Install.pm Fri Mar 25 22:53:28 2005 @@ -73,7 +73,7 @@ sub new { $args{dispatch} ||= 'Admin'; $args{prefix} ||= 'inc'; -$args{author} ||= '.author'; +$args{author} ||= ($^O eq 'VMS' ? '_author' : '.author'); $args{bundle} ||= 'inc/BUNDLES'; $class =~ s/^\Q$args{prefix}\E:://; @@ -130,7 +130,7 @@ sub load_extensions { my ($self, $path, $top_obj) = @_; unshift @INC, $self-{prefix} -unless grep { $_ eq $self-{prefix} } @INC; +unless grep { lc($_) eq lc($self-{prefix}) } @INC; local @INC = ($path, @INC); foreach my $rv ($self-find_extensions($path)) { @@ -152,10 +152,31 @@ sub find_extensions { File::Find::find(sub { my $file = $File::Find::name; return unless $file =~ m!^\Q$path\E/(.+)\.pm\Z!is; -return if $1 eq $self-{dispatch}; +return if lc($1) eq lc($self-{dispatch}); $file = $self-{path}/$1.pm; my $pkg = $self-{name}::$1; $pkg =~ s!/!::!g; + +# If we have a mixed-case package name, assume case has been preserved +# correctly. Otherwise, root through the file to locate the case-preserved +# version of the package name. + +if ($1 eq lc($1) || $1 eq uc($1)) { +open PKGFILE, $1.pm or die find_extensions: Can't open $1.pm: $!; +my $in_pod = 0; +while (PKGFILE) { +$in_pod = 1 if /^=\w/; +$in_pod = 0 if /^=cut/; +next if ($in_pod || /^=cut/); # skip pod text +next if /^\s*#/; # and comments + +if (m/^\s*package\s+($pkg)\s*;/i) { +$pkg = $1; +last; +} +} +close PKGFILE; +} push @found, [$file, $pkg]; }, $path) if -d $path; --- inc/Module/Install/Makefile.pm;-0 Thu Sep 9 10:01:46 2004 +++
Re: [PATCH] Module::Install 0.36 for VMS (was Re: Module::Install and portability?)
On Sat, Mar 26, 2005 at 09:35:10AM -0600, Craig A. Berry wrote: 2.) Use '_author' instead of '.author' when on VMS since a dot in a directory name is usually invalid and always awkward. Really? I've yet to see a problem with .foo style on VMS. Where does it go wrong? If it is a bad thing on VMS, MI should use _foo everywhere rather than create Yet Another VMS Exception.
Re: [PATCH] Module::Install 0.36 for VMS (was Re: Module::Install and portability?)
[Only monitoring vmsperl@perl.org for replies] Michael G Schwern wrote: On Sat, Mar 26, 2005 at 09:35:10AM -0600, Craig A. Berry wrote: 2.) Use '_author' instead of '.author' when on VMS since a dot in a directory name is usually invalid and always awkward. Really? I've yet to see a problem with .foo style on VMS. Where does it go wrong? It appears to go wrong in that the .foo/bar style of names is only supported on the ODS-5 filesystem and not ODS-2 and currently PERL on OpenVMS does not implement support for ODS-5. .foo as not a directory file is allowed with ODS-2, so such code does not need to be changed. The ODS-5 file system is only available on OpenVMS Alpha and I64. The current code to translate from VMS to UNIX and back file specifications is translating the extra dots in directory and filenames into _ characters, even when it should not, which is making some files on ODS-5 volumes invisible. In the stuff that I am testing for symbolic link support, I have implemented changes so that when translating an VMS specification with the extra dots to a UNIX style path, it will translate it correctly. It will also translate a UNIX style path with extra dots in it back to a VMS ODS-5 specification with out the dots being translated to _ if the SET PROC/PARSE=EXTENDED is set. I will not be implementing full ODS-5 support in this pass for VMS mode of filenames. If the mode is set to DECC$FILENAME_UNIX_ONLY after my changes, almost all UNIX file specifications should work on ODS-5 volumes. If it is a bad thing on VMS, MI should use _foo everywhere rather than create Yet Another VMS Exception. It will continue to be needed on directories for ODS-2 file system support. ODS-2 only allows 1 dot in a file specification and only if that file is not a directory. It also does not allow a directory specification to begin with a - character for most versions of OpenVMS that are currently be in use. Also with the stuff that I am doing for the symlink support, also the case sensitivity of perl on OpenVMS will reflect the state of the process setting, and not be hard coded to case insensitive. The resulting Perl on OpenVMS will properly pay attention to several of the DECC$ feature logicals as far as preserving case. The result should be that many Perl scripts that will not currently run on OpenVMS will run if the external mode controls are set appropriately. I am still debugging the changes needed for symbolic link support. -John [EMAIL PROTECTED] Personal Opinion Only
Re: [PATCH] Module::Install 0.36 for VMS (was Re: Module::Install and portability?)
At 2:00 PM -0800 3/26/05, Michael G Schwern wrote: On Sat, Mar 26, 2005 at 09:35:10AM -0600, Craig A. Berry wrote: 2.) Use '_author' instead of '.author' when on VMS since a dot in a directory name is usually invalid and always awkward. Really? I've yet to see a problem with .foo style on VMS. Where does it go wrong? If it is a bad thing on VMS, MI should use _foo everywhere rather than create Yet Another VMS Exception. The problem is it does a C-d '.author', expecting the dot to be part of the directory name, not just a directory separator. So in VMS syntax, that's C[..author], which is invalid on ODS-2 volumes or with traditional parsing in effect: $ create/directory [..author] %CREATE-E-DIRNOTCRE, [..AUTHOR] directory file not created -RMS-F-SYN, file specification syntax error On an ODS-5 volume on VMS 7.2 or later with extended parsing enabled, you can force a dot into a directory name by escaping it with a caret: $ create/directory [.^.author] $ directory ^.author.dir Directory DISK1:[perlStuff] ^.author.DIR;1 Total of 1 file. $ perl -e print -d '^.author'; 1 But then you have to stick the caret in whenever you refer to it in order to make clear the dot is not a directory separator, and neither the File::Spec nor the VMS::Filespec functions handle the carets properly (yet). So that's the long-winded version of usually invalid and always awkward. As far as using an underscore on all platforms (or getting rid of non-word characters entirely and just having Cauthor), that'd be fine by me, but wouldn't it break things for anybody who's already got a .author directory? -- Craig A. Berry mailto:[EMAIL PROTECTED] ... getting out of a sonnet is much more difficult than getting in. Brad Leithauser