Thread DosGlob & Verzeichnisse mit Leerzeichen (10 answers)
Opened by pktm at 2005-08-13 03:13

pktm
 2005-08-13 03:43
#57168 #57168
User since
2003-08-07
2921 Artikel
BenutzerIn
[Homepage]
user image
Das bringt leider keine Änderung (sitez halt an einem Win32-System).
Hier mal ein ausführlicherer Testcode (jetzt wisst ihr, woher das Gerücht kommt, dass Perl unleserlich wäre :-D ):
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/Perl/bin/perl

use strict;
use Data::Dumper;
use File::Spec;
use File::DosGlob;

print "Version: " . $File::DosGlob::VERSION . "\n";

print "dir with spaces, Win32-OS (XP home), unix-slash-notation\n";
my $dir = "C:/Dokumente und Einstellungen/pktm/*.*";
print "dir: $dir \n";
my @r = File::DosGlob::glob($dir);
print "output:\n";
print Data::Dumper::Dumper( \@r );

print "\nnext: dir without spaces\n";
my $dir2 = "C:/*.*";
print "dir: $dir2 \n";
@r = File::DosGlob::glob($dir2);
print "output:\n";
print Data::Dumper::Dumper( \@r );

print "\nnext: dir with spaces and File::Spec\n";
my $dir3 = File::Spec->catfile("C:/Dokumente und Einstellungen/pktm/", '*.*');
print "dir: $dir3 \n";
@r = File::DosGlob::glob($dir3);
print "output:\n";
print Data::Dumper::Dumper( \@r );

# Vollständiger Output:
#Use of uninitialized value in substr at C:/Perl/lib/File/DosGlob.pm line 38.
#Version: 1.00
#dir with spaces, Win32-OS (XP home), unix-slash-notation
#dir: C:/Dokumente und Einstellungen/pktm/*.*
#output:
#$VAR1 = [];
#
#next: dir without spaces
#dir: C:/*.*
#
#output:
#$VAR1 = [
#          'C:/.cpan',
# ...lots of files...
#        ];
#
#next: dir with spaces and File::Spec
#dir: C:\Dokumente und Einstellungen\pktm\*.*
#output:
#$VAR1 = [];
\n\n

<!--EDIT|pktm|1123890268-->
http://www.intergastro-service.de (mein erstes CMS :) )

View full thread DosGlob & Verzeichnisse mit Leerzeichen