Peter Prymmer wrote:
!As I mentioned I have a modified perl 5.8.0 that
!accepts -g like so:
!
!$ perl -e "print join('< >',@ARGV)" perl.*
!perl.c< >perl.exe< >perl.h< >perl.obj
!$ perl -g -e "print join('< >',@ARGV)" perl.*
!perl.*
!
!But instead of introducing -g as a perlrun switch (which
!becomes a noop on non VMS platforms) I'd rather smarten up
!the workings of mp_expand_wild_cards() in vms.c.
OK here is the patch that could be applied to perl@18376
to affect the change that I said I wanted. With it
applied (as well as the two test fixes that started this
discussion thread) I see only these `mmk test` failures:
t/run/switchi........................FAILED at test 2
ext/Devel/Peek/Peek..................FAILED at test 21
lib/charnames........................FAILED at test 74
lib/File/Find/t/find.................FAILED at test 1
lib/File/Find/t/taint................FAILED at test 1
lib/Net/hostent......................FAILED at test 5
lib/Net/Ping/t/450_service...........FAILED at test 13
Failed 7 test scripts out of 671, 98.96% okay.
The patch to vms/vms.c and vms/perlvms.pod appears as:
diff -ru perl_18376/vms/perlvms.pod perl/vms/perlvms.pod
--- perl_18376/vms/perlvms.pod Thu Aug 22 19:01:13 2002
+++ perl/vms/perlvms.pod Fri Jan 3 11:13:01 2003
@@ -121,8 +121,9 @@
I<N.B.> The procedure by which extensions are built and
tested creates several levels (at least 4) under the
directory in which the extension's source files live.
-For this reason, you shouldn't nest the source directory
-too deeply in your directory structure, lest you exceed RMS'
+For this reason if you are runnning a version of VMS prior
+to V7.1 you shouldn't nest the source directory
+too deeply in your directory structure lest you exceed RMS'
maximum of 8 levels of subdirectory in a filespec. (You
can use rooted logical names to get another 8 levels of
nesting, if you can't place the files near the top of
@@ -139,22 +140,39 @@
be added to the linker options file F<PGPLOT.Opt> produced
during the build process for the Perl extension.
-By default, the shareable image for an extension is placed
-F<[.lib.site_perl.auto>I<Arch>.I<Extname>F<]> directory of the
+By default, the shareable image for an extension is placed in
+the F<[.lib.site_perl.auto>I<Arch>.I<Extname>F<]> directory of the
installed Perl directory tree (where I<Arch> is F<VMS_VAX> or
F<VMS_AXP>, and I<Extname> is the name of the extension, with
each C<::> translated to C<.>). (See the MakeMaker documentation
for more details on installation options for extensions.)
However, it can be manually placed in any of several locations:
- - the F<[.Lib.Auto.>I<Arch>I<$PVers>I<Extname>F<]> subdirectory
- of one of the directories in C<@INC> (where I<PVers>
- is the version of Perl you're using, as supplied in C<$]>,
- with '.' converted to '_'), or
- - one of the directories in C<@INC>, or
- - a directory which the extensions Perl library module
- passes to the DynaLoader when asking it to map
- the shareable image, or
- - F<Sys$Share> or F<Sys$Library>.
+
+=over 4
+
+=item *
+
+the F<[.Lib.Auto.>I<Arch>I<$PVers>I<Extname>F<]> subdirectory
+of one of the directories in C<@INC> (where I<PVers>
+is the version of Perl you're using, as supplied in C<$]>,
+with '.' converted to '_'), or
+
+=item *
+
+one of the directories in C<@INC>, or
+
+=item *
+
+a directory which the extensions Perl library module
+passes to the DynaLoader when asking it to map
+the shareable image, or
+
+=item *
+
+F<Sys$Share> or F<Sys$Library>.
+
+=back
+
If the shareable image isn't in any of these places, you'll need
to define a logical name I<Extshortname>, where I<Extshortname>
is the portion of the extension's name after the last C<::>, which
@@ -198,8 +216,24 @@
the wildcard filespec uses VMS syntax, the resultant
filespecs will follow VMS syntax; if a Unix-style filespec is
passed in, Unix-style filespecs will be returned.
+Similar to the behavior of wildcard globbing for a Unix shell,
+one can escape command line wildcards with double quotation
+marks C<"> around a perl program command line argument. However,
+owing to the stripping of C<"> characters carried out by the C
+handling of argv you will need to escape a construct such as
+this one (in a directory containing the files F<PERL.C>, F<PERL.EXE>,
+F<PERL.H>, and F<PERL.OBJ>):
+
+ $ perl -e "print join(' ',@ARGV)" perl.*
+ perl.c perl.exe perl.h perl.obj
+
+in the following triple quoted manner:
+
+ $ perl -e "print join(' ',@ARGV)" """perl.*"""
+ perl.*
-In both cases, VMS wildcard expansion is performed. (csh-style
+In both the case of unquoted command line arguments or in calls
+to C<glob()> VMS wildcard expansion is performed. (csh-style
wildcard expansion is available if you use C<File::Glob::glob>.)
If the wildcard filespec contains a device or directory
specification, then the resultant filespecs will also contain
@@ -258,7 +292,7 @@
Perl for VMS supports redirection of input and output on the
command line, using a subset of Bourne shell syntax:
-=over
+=over 4
=item *
diff -ru perl_18376/vms/vms.c perl/vms/vms.c
--- perl_18376/vms/vms.c Sat Oct 19 19:25:29 2002
+++ perl/vms/vms.c Fri Jan 3 11:12:54 2003
@@ -4144,6 +4144,7 @@
int expcount = 0;
unsigned long int context = 0;
int isunix = 0;
+int item_len = 0;
char *had_version;
char *had_device;
int had_directory;
@@ -4160,8 +4161,22 @@
}
if (!*cp || isspace(*cp))
{
- add_item(head, tail, item, count);
- return;
+ add_item(head, tail, item, count);
+ return;
+ }
+ else
+ {
+ /* "double quoted" wild card expressions pass as is */
+ /* From DCL that means using e.g.: */
+ /* perl program """perl.*""" */
+ item_len = strlen(item);
+ if ( '"' == *item && '"' == item[item_len-1] )
+ {
+ item++;
+ item[item_len-2] = '\0';
+ add_item(head, tail, item, count);
+ return;
+ }
}
resultspec.dsc$b_dtype = DSC$K_DTYPE_T;
resultspec.dsc$b_class = DSC$K_CLASS_D;
End of Possible patch.
(note that I've turned a list like item in perlvms.pod into
an honest pod =over 4 list, it checks out with syntax OK
under podchecker5.9.0 with or without this patch applied FWIW).
So the questions I have are: 1. Does anyone besides me want to
see this change in vmsperl? 2. If the answer to the previous
question is "yes" then which interface is preferred?:
perl -g -e "print join(' ',@ARGV)" perl.*
or this:
perl -e "print join(' ',@ARGV)" """perl.*"""
The former seems easier to use, particularly with symbols
such as:
$ myscript :== 'perl' -g disk:[dir]myscript.pl
whereas the latter would require users of myscript to
have to triple quote the wild card expressions that
needed to go unexpanded. On the other hand this change
(the one that make triple quoting possible) seems more
in keeping with the way things are done on Unix and
does not take away from other platforms the ability to
use a switch such as -g at some future time (there
are rather few letter in the roman alphabet left that have
not been pressed into service as switches for perl).
3. Might there have been a better way that I still have
not covered? 4. Does anyone foresee trouble? I've
thought that this change does not necessarily interfere
with oddball file specs, such as e.g. use of the user name
password DECnet spec without a PROXY:
perl scriptname NODE"user passwd"::DEV:[DIR]FOO.%
if that needed to go unexpanded would be:
perl scriptname """NODE""user passwd""::DEV:[DIR]FOO.%"""
which is (I think) not a problem. Am I wrong?
Comments?
Peter Prymmer