Subject: | please use File::Glob |
Hello,
The standard glob() reacts very strangely with spaces in string. This is
definitively no what cp -rf do.
"c:/program files/*" gives "c:/program"
This is an example of the standard glob() and different glob alternatives.
#!/usr/bin/perl -w
use strict;
use warnings;
use File::Glob;
use File::Dosglob;
use Data::Dumper;
my $toto = 'c:/program files/*';
print "glob\n";
print Dumper(glob($toto));
print "File::Glob::glob\n";
print Dumper(File::Glob::glob($toto));
print "File::Glob::bsd_glob\n";
print Dumper(File::Glob::bsd_glob($toto));
GIVES=========>
glob
$VAR1 = 'c:/program';
File::Glob::glob
$VAR1 = 'c:/program files/7-Zip';
$VAR2 = 'c:/program files/Common Files';
$VAR3 = 'c:/program files/ComPlus Applications';
$VAR4 = 'c:/program files/FusionInventory-Agent';
$VAR5 = 'c:/program files/FusionInventory-Agent-old';
$VAR6 = 'c:/program files/Git';
$VAR7 = 'c:/program files/Internet Explorer';
$VAR8 = 'c:/program files/Messenger';
$VAR9 = 'c:/program files/microsoft frontpage';
$VAR10 = 'c:/program files/Movie Maker';
$VAR11 = 'c:/program files/MSBuild';
$VAR12 = 'c:/program files/MSN';
$VAR13 = 'c:/program files/MSN Gaming Zone';
$VAR14 = 'c:/program files/NetMeeting';
$VAR15 = 'c:/program files/Nmap';
$VAR16 = 'c:/program files/Online Services';
$VAR17 = 'c:/program files/Outlook Express';
$VAR18 = 'c:/program files/Reference Assemblies';
$VAR19 = 'c:/program files/TortoiseGit';
$VAR20 = 'c:/program files/Uninstall Information';
$VAR21 = 'c:/program files/Vim';
$VAR22 = 'c:/program files/VMware';
$VAR23 = 'c:/program files/Windows Media Player';
$VAR24 = 'c:/program files/Windows NT';
$VAR25 = 'c:/program files/WindowsUpdate';
$VAR26 = 'c:/program files/WinPcap';
$VAR27 = 'c:/program files/WinSCP';
$VAR28 = 'c:/program files/xerox';
File::Glob::bsd_glob
$VAR1 = 'c:/program files/7-Zip';
$VAR2 = 'c:/program files/Common Files';
$VAR3 = 'c:/program files/ComPlus Applications';
$VAR4 = 'c:/program files/FusionInventory-Agent';
$VAR5 = 'c:/program files/FusionInventory-Agent-old';
$VAR6 = 'c:/program files/Git';
$VAR7 = 'c:/program files/Internet Explorer';
$VAR8 = 'c:/program files/Messenger';
$VAR9 = 'c:/program files/microsoft frontpage';
$VAR10 = 'c:/program files/Movie Maker';
$VAR11 = 'c:/program files/MSBuild';
$VAR12 = 'c:/program files/MSN';
$VAR13 = 'c:/program files/MSN Gaming Zone';
$VAR14 = 'c:/program files/NetMeeting';
$VAR15 = 'c:/program files/Nmap';
$VAR16 = 'c:/program files/Online Services';
$VAR17 = 'c:/program files/Outlook Express';
$VAR18 = 'c:/program files/Reference Assemblies';
$VAR19 = 'c:/program files/TortoiseGit';
$VAR20 = 'c:/program files/Uninstall Information';
$VAR21 = 'c:/program files/Vim';
$VAR22 = 'c:/program files/VMware';
$VAR23 = 'c:/program files/Windows Media Player';
$VAR24 = 'c:/program files/Windows NT';
$VAR25 = 'c:/program files/WindowsUpdate';
$VAR26 = 'c:/program files/WinPcap';
$VAR27 = 'c:/program files/WinSCP';
$VAR28 = 'c:/program files/xerox';
Can you please replace the glob() call by File::Glob::bsd_glob() or
provide a way to select the preferred option.
Best regards,
Gonéri Le Bouder