Thread Windows Dateiattribute abfragen (8 answers)
Opened by bianca at 2011-02-01 14:48

bianca
 2011-02-01 16:25
#145249 #145249
User since
2009-09-13
6978 Artikel
BenutzerIn

user image
Stimmt!
Dein Code klappt auch bei mir.

Warum klappt mein damaliger Code auch heute (noch) nicht?
Wichtig ist, ein Nichtvorhandensein des Moduls darf nicht zum Scriptabbruch führen, daher verwende ich kein "normales" use. Hat das vielleicht damit zu tun?
Habe sowohl | als auch & in Zeile 14 versucht. Bringt immer true. Warum?

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/perl -w
use strict;
use warnings;

my $errorbindings;
BEGIN {
        eval "use Win32::File qw/ ARCHIVE /";
        if ($@) {
                $errorbindings = $@;
        }
}
if (!$errorbindings) {
        Win32::File::GetAttributes('$0', my $attributes);
        if ( $attributes | ARCHIVE() ) {
                print "Attribut fuer $0 ist gesetzt\n";
        }
}
else { print "Schrott: >$errorbindings<\n" }  


Editiert von bianca: Typo
Last edited: 2011-02-01 16:28:00 +0100 (CET)
10 print "Hallo"
20 goto 10

View full thread Windows Dateiattribute abfragen