This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[win32] fix perlglob.bat warnings by splitting it from File::DosGlob
authorGurusamy Sarathy <gsar@cpan.org>
Tue, 13 Jan 1998 20:49:52 +0000 (20:49 +0000)
committerGurusamy Sarathy <gsar@cpan.org>
Tue, 13 Jan 1998 20:49:52 +0000 (20:49 +0000)
p4raw-id: //depot/win32/perl@417

MANIFEST
README.win32
lib/File/DosGlob.pm
win32/Makefile
win32/bin/perlglob.pl [new file with mode: 0644]
win32/makefile.mk

index 243039f..7d6b83a 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -871,6 +871,7 @@ win32/Makefile              Win32 makefile for NMAKE (Visual C++ build)
 win32/TEST             Win32 port
 win32/autosplit.pl     Win32 port
 win32/bin/network.pl   Win32 port
 win32/TEST             Win32 port
 win32/autosplit.pl     Win32 port
 win32/bin/network.pl   Win32 port
+win32/bin/perlglob.pl  glob() support
 win32/bin/pl2bat.pl    wrap perl scripts into batch files
 win32/bin/runperl.pl   run perl script via batch file namesake
 win32/bin/search.pl    Win32 port
 win32/bin/pl2bat.pl    wrap perl scripts into batch files
 win32/bin/runperl.pl   run perl script via batch file namesake
 win32/bin/search.pl    Win32 port
index fb42850..233bb63 100644 (file)
@@ -237,16 +237,17 @@ perlglob.bat.
 perlglob.exe relies on the argv expansion done by the C Runtime of
 the particular compiler you used, and therefore behaves very
 differently depending on the Runtime used to build it.  To preserve
 perlglob.exe relies on the argv expansion done by the C Runtime of
 the particular compiler you used, and therefore behaves very
 differently depending on the Runtime used to build it.  To preserve
-compatiblity, perlglob.bat (a perl script/module that can be
-used portably) is installed.  Besides being portable, perlglob.bat
-also offers enhanced globbing functionality.
+compatiblity, perlglob.bat (a perl script that can be used portably)
+is installed.  Besides being portable, perlglob.bat also offers
+enhanced globbing functionality.
 
 If you want perl to use perlglob.bat instead of perlglob.exe, just
 delete perlglob.exe from the install location (or move it somewhere
 
 If you want perl to use perlglob.bat instead of perlglob.exe, just
 delete perlglob.exe from the install location (or move it somewhere
-perl cannot find).  Using File::DosGlob.pm (which is the same
-as perlglob.bat) to override the internal CORE::glob() works about 10
-times faster than spawing perlglob.exe, and you should take this
-approach when writing new modules.  See File::DosGlob for details.
+perl cannot find).  Using File::DosGlob.pm (which implements the core
+functionality of perlglob.bat) to override the internal CORE::glob()
+works about 10 times faster than spawing perlglob.exe, and you should
+take this approach when writing new modules.  See File::DosGlob for
+details.
 
 =item Using perl from the command line
 
 
 =item Using perl from the command line
 
index 4597c71..a27dad9 100644 (file)
@@ -6,21 +6,6 @@
 
 package File::DosGlob;
 
 
 package File::DosGlob;
 
-unless (caller) {
-    $| = 1;
-    while (@ARGV) {
-       #
-       # We have to do this one by one for compatibility reasons.
-       # If an arg doesn't match anything, we are supposed to return
-       # the original arg.  I know, it stinks, eh?
-       #
-       my $arg = shift;
-       my @m = doglob(1,$arg);
-       print (@m ? join("\0", sort @m) : $arg);
-       print "\0" if @ARGV;
-    }
-}
-
 sub doglob {
     my $cond = shift;
     my @retval = ();
 sub doglob {
     my $cond = shift;
     my @retval = ();
@@ -159,8 +144,6 @@ __END__
 
 File::DosGlob - DOS like globbing and then some
 
 
 File::DosGlob - DOS like globbing and then some
 
-perlglob.bat - a more capable perlglob.exe replacement
-
 =head1 SYNOPSIS
 
     require 5.004;
 =head1 SYNOPSIS
 
     require 5.004;
@@ -173,14 +156,11 @@ perlglob.bat - a more capable perlglob.exe replacement
     
     # from the command line (overrides only in main::)
     > perl -MFile::DosGlob=glob -e "print <../pe*/*p?>"
     
     # from the command line (overrides only in main::)
     > perl -MFile::DosGlob=glob -e "print <../pe*/*p?>"
-    
-    > perlglob ../pe*/*p?
 
 =head1 DESCRIPTION
 
 A module that implements DOS-like globbing with a few enhancements.
 
 =head1 DESCRIPTION
 
 A module that implements DOS-like globbing with a few enhancements.
-This file is also a portable replacement for perlglob.exe.  It
-is largely compatible with perlglob.exe (the M$ setargv.obj
+It is largely compatible with perlglob.exe (the M$ setargv.obj
 version) in all but one respect--it understands wildcards in
 directory components.
 
 version) in all but one respect--it understands wildcards in
 directory components.
 
@@ -191,17 +171,6 @@ backslashes and forward slashes are both accepted, and preserved.
 You may have to double the backslashes if you are putting them in
 literally, due to double-quotish parsing of the pattern by perl.
 
 You may have to double the backslashes if you are putting them in
 literally, due to double-quotish parsing of the pattern by perl.
 
-When invoked as a program, it will print null-separated filenames
-to standard output.
-
-While one may replace perlglob.exe with this, usage by overriding
-CORE::glob via importation should be much more efficient, because
-it avoids launching a separate process, and is therefore strongly
-recommended.  Note that it is currently possible to override
-builtins like glob() only on a per-package basis, not "globally".
-Thus, every namespace that wants to override glob() must explicitly
-request the override.  See L<perlsub>.
-
 Extending it to csh patterns is left as an exercise to the reader.
 
 =head1 EXPORTS (by request only)
 Extending it to csh patterns is left as an exercise to the reader.
 
 =head1 EXPORTS (by request only)
@@ -246,5 +215,7 @@ Initial version (GSAR 20-FEB-97)
 
 perl
 
 
 perl
 
+perlglob.bat
+
 =cut
 
 =cut
 
index 1aa5747..478137e 100644 (file)
@@ -347,7 +347,7 @@ POD2TEXT=$(PODDIR)\pod2text
 #
 
 all: $(PERLEXE) $(PERL95EXE) $(GLOBEXE) $(DYNALOADMODULES) $(MINIMOD) \
 #
 
 all: $(PERLEXE) $(PERL95EXE) $(GLOBEXE) $(DYNALOADMODULES) $(MINIMOD) \
-       $(X2P) $(GLOBBAT)
+       $(X2P)
 
 $(DYNALOADER)$(o) : $(DYNALOADER).c $(CORE_H) $(EXTDIR)\DynaLoader\dlutils.c
 
 
 $(DYNALOADER)$(o) : $(DYNALOADER).c $(CORE_H) $(EXTDIR)\DynaLoader\dlutils.c
 
@@ -357,9 +357,6 @@ $(GLOBEXE): perlglob$(o)
        $(LINK32) $(LINK_FLAGS) $(LIBFILES) -out:$@ -subsystem:$(SUBSYS) \
            perlglob$(o) setargv$(o) 
 
        $(LINK32) $(LINK_FLAGS) $(LIBFILES) -out:$@ -subsystem:$(SUBSYS) \
            perlglob$(o) setargv$(o) 
 
-$(GLOBBAT) : ..\lib\File\DosGlob.pm $(MINIPERL)
-       $(MINIPERL) $(PL2BAT) - < ..\lib\File\DosGlob.pm > $(GLOBBAT)
-
 perlglob$(o)  : perlglob.c
 
 ..\miniperlmain$(o) : ..\miniperlmain.c $(CORE_H)
 perlglob$(o)  : perlglob.c
 
 ..\miniperlmain$(o) : ..\miniperlmain.c $(CORE_H)
@@ -535,7 +532,7 @@ utils: $(PERLEXE)
        $(XCOPY) *.bat ..\win32\bin\*.*
        cd ..\win32
        $(PERLEXE) $(PL2BAT) bin\network.pl bin\www.pl bin\runperl.pl \
        $(XCOPY) *.bat ..\win32\bin\*.*
        cd ..\win32
        $(PERLEXE) $(PL2BAT) bin\network.pl bin\www.pl bin\runperl.pl \
-                       bin\pl2bat.pl
+                       bin\pl2bat.pl bin\perlglob.pl
 
 distclean: clean
        -del /f $(MINIPERL) $(PERLEXE) $(PERL95EXE) $(PERLDLL) $(GLOBEXE) \
 
 distclean: clean
        -del /f $(MINIPERL) $(PERLEXE) $(PERL95EXE) $(PERLDLL) $(GLOBEXE) \
@@ -569,7 +566,7 @@ inst_lib : $(CONFIGPM)
        $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" "../LIB/auto"
        $(RCOPY) ..\lib $(INST_LIB)\*.*
 
        $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" "../LIB/auto"
        $(RCOPY) ..\lib $(INST_LIB)\*.*
 
-minitest : $(MINIPERL) $(GLOBEXE) $(CONFIGPM)
+minitest : $(MINIPERL) $(GLOBEXE) $(CONFIGPM) utils
        $(XCOPY) $(MINIPERL) ..\t\perl.exe
        $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
        attrib -r ..\t\*.*
        $(XCOPY) $(MINIPERL) ..\t\perl.exe
        $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
        attrib -r ..\t\*.*
@@ -578,7 +575,7 @@ minitest : $(MINIPERL) $(GLOBEXE) $(CONFIGPM)
        $(MINIPERL) -I..\lib test base/*.t comp/*.t cmd/*.t io/*.t op/*.t pragma/*.t
        cd ..\win32
 
        $(MINIPERL) -I..\lib test base/*.t comp/*.t cmd/*.t io/*.t op/*.t pragma/*.t
        cd ..\win32
 
-test-prep : all
+test-prep : all utils
        $(XCOPY) $(PERLEXE) ..\t\$(NULL)
        $(XCOPY) $(PERLDLL) ..\t\$(NULL)
        $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
        $(XCOPY) $(PERLEXE) ..\t\$(NULL)
        $(XCOPY) $(PERLDLL) ..\t\$(NULL)
        $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
diff --git a/win32/bin/perlglob.pl b/win32/bin/perlglob.pl
new file mode 100644 (file)
index 0000000..6467e57
--- /dev/null
@@ -0,0 +1,53 @@
+#!perl -w
+use File::DosGlob;
+$| = 1;
+while (@ARGV) {
+    my $arg = shift;
+    my @m = File::DosGlob::doglob(1,$arg);
+    print (@m ? join("\0", sort @m) : $arg);
+    print "\0" if @ARGV;
+}
+__END__
+
+=head1 NAME
+
+perlglob.bat - a more capable perlglob.exe replacement
+
+=head1 SYNOPSIS
+
+    @perlfiles = glob  "..\\pe?l/*.p?";
+    print <..\\pe?l/*.p?>;
+
+    # more efficient version
+    > perl -MFile::DosGlob=glob -e "print <../pe?l/*.p?>"
+
+=head1 DESCRIPTION
+
+This file is a portable replacement for perlglob.exe.  It
+is largely compatible with perlglob.exe (the Microsoft setargv.obj
+version) in all but one respect--it understands wildcards in
+directory components.
+
+It prints null-separated filenames to standard output.
+
+For details of the globbing features implemented, see
+L<File::DosGlob>.
+
+While one may replace perlglob.exe with this, usage by overriding
+CORE::glob with File::DosGlob::glob should be much more efficient,
+because it avoids launching a separate process, and is therefore
+strongly recommended.  See L<perlsub> for details of overriding
+builtins.
+
+=head1 AUTHOR
+
+Gurusamy Sarathy <gsar@umich.edu>
+
+=head1 SEE ALSO
+
+perl
+
+File::DosGlob
+
+=cut
+
index c83f498..245d904 100644 (file)
@@ -458,7 +458,7 @@ POD2TEXT=$(PODDIR)\pod2text
 #
 
 all: $(PERLEXE) $(PERL95EXE) $(GLOBEXE) $(DYNALOADMODULES) $(MINIMOD) \
 #
 
 all: $(PERLEXE) $(PERL95EXE) $(GLOBEXE) $(DYNALOADMODULES) $(MINIMOD) \
-       $(X2P) $(GLOBBAT)
+       $(X2P)
 
 $(DYNALOADER)$(o) : $(DYNALOADER).c $(CORE_H) $(EXTDIR)\DynaLoader\dlutils.c
 
 
 $(DYNALOADER)$(o) : $(DYNALOADER).c $(CORE_H) $(EXTDIR)\DynaLoader\dlutils.c
 
@@ -476,9 +476,6 @@ $(GLOBEXE): perlglob$(o)
            perlglob$(o) setargv$(o) 
 .ENDIF
 
            perlglob$(o) setargv$(o) 
 .ENDIF
 
-$(GLOBBAT) : ..\lib\File\DosGlob.pm $(MINIPERL)
-       $(MINIPERL) $(PL2BAT) - < ..\lib\File\DosGlob.pm > $(GLOBBAT)
-
 perlglob$(o)  : perlglob.c
 
 ..\miniperlmain$(o) : ..\miniperlmain.c $(CORE_H)
 perlglob$(o)  : perlglob.c
 
 ..\miniperlmain$(o) : ..\miniperlmain.c $(CORE_H)
@@ -696,7 +693,7 @@ utils: $(PERLEXE)
                pl2pm c2ph h2xs perldoc pstruct
        $(XCOPY) ..\utils\*.bat bin\*.*
        $(PERLEXE) -I..\lib $(PL2BAT) bin\network.pl bin\www.pl bin\runperl.pl \
                pl2pm c2ph h2xs perldoc pstruct
        $(XCOPY) ..\utils\*.bat bin\*.*
        $(PERLEXE) -I..\lib $(PL2BAT) bin\network.pl bin\www.pl bin\runperl.pl \
-                       bin\pl2bat.pl
+                       bin\pl2bat.pl bin\perlglob.pl
 
 distclean: clean
        -del /f $(MINIPERL) $(PERLEXE) $(PERL95EXE) $(PERLDLL) $(GLOBEXE) \
 
 distclean: clean
        -del /f $(MINIPERL) $(PERLEXE) $(PERL95EXE) $(PERLDLL) $(GLOBEXE) \
@@ -732,7 +729,7 @@ inst_lib : $(CONFIGPM)
        $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" "../LIB/auto"
        $(RCOPY) ..\lib $(INST_LIB)\*.*
 
        $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" "../LIB/auto"
        $(RCOPY) ..\lib $(INST_LIB)\*.*
 
-minitest : $(MINIPERL) $(GLOBEXE) $(CONFIGPM)
+minitest : $(MINIPERL) $(GLOBEXE) $(CONFIGPM) utils
        $(XCOPY) $(MINIPERL) ..\t\perl.exe
 .IF "$(CCTYPE)" == "BORLAND"
        $(XCOPY) $(GLOBBAT) ..\t\$(NULL)
        $(XCOPY) $(MINIPERL) ..\t\perl.exe
 .IF "$(CCTYPE)" == "BORLAND"
        $(XCOPY) $(GLOBBAT) ..\t\$(NULL)
@@ -744,7 +741,7 @@ minitest : $(MINIPERL) $(GLOBEXE) $(CONFIGPM)
        cd ..\t && \
        $(MINIPERL) -I..\lib test base/*.t comp/*.t cmd/*.t io/*.t op/*.t pragma/*.t
 
        cd ..\t && \
        $(MINIPERL) -I..\lib test base/*.t comp/*.t cmd/*.t io/*.t op/*.t pragma/*.t
 
-test-prep : all
+test-prep : all utils
        $(XCOPY) $(PERLEXE) ..\t\$(NULL)
        $(XCOPY) $(PERLDLL) ..\t\$(NULL)
 .IF "$(CCTYPE)" == "BORLAND"
        $(XCOPY) $(PERLEXE) ..\t\$(NULL)
        $(XCOPY) $(PERLDLL) ..\t\$(NULL)
 .IF "$(CCTYPE)" == "BORLAND"