Thread windows attrib mit perl? (40 answers)
Opened by bianca at 2009-10-10 12:31

bianca
 2009-10-10 16:28
#126837 #126837
User since
2009-09-13
6978 Artikel
BenutzerIn

user image
2009-10-10T14:16:15 pq
argh, wieso laesst du denn in dem code jetzt die konstanten im use-statement wieder weg? an der einen stelle fixt du was und an der anderen machst du aber wieder den alten fehler.

Keine Ahnung, was Du meinst.

Aktueller Code:

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/perl -w
use strict;
use warnings;
my $errorbindings = '';
BEGIN {
        eval "use Win32::File qw/ ARCHIVE /";
        if ($@) {
                $errorbindings = $@;
        }
}
if (!$errorbindings) {
        my $test = Win32::File::GetAttributes ("eval.pl",ARCHIVE);
        print "test: >$test<\n";
}
else { print "Schrott: >$errorbindings<\n" }


Bringt:
Quote
test: >1<
was allerdings kompletter Unfug ist, weil die Datei das Attribut nicht hat, trotzdem wird 1 geliefert??
Der Beschreibung "All of the functions return FALSE (0) if they fail, unless otherwise noted." nach würde ich vermuten, '0' statt '1' zu bekommen, wenn eine Datei mit der OR-ed combination 'ARCHIVE' diese Bedingung nicht erfüllt. Oder gehör ich in die Klapse?

Wenn ich nun DEN NAMEN DES MODULS VERFÄLSCHE (nochmal in Großbuchstaben für pq!) um zu simulieren, dass das Modul nicht geladen werden kann erhalte ich immernoch Ausgabe auf STDOUT, die ich NICHT HABEN WILL:

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/perl -w
use strict;
use warnings;
my $errorbindings = '';
BEGIN {
        eval "use Win32::Filex qw/ ARCHIVE /";
        if ($@) {
                $errorbindings = $@;
        }
}
if (!$errorbindings) {
        my $test = Win32::File::GetAttributes ("eval.pl",ARCHIVE);
        print "test: >$test<\n";
}
else { print "Schrott: >$errorbindings<\n" }


Quote
Bareword "ARCHIVE" not allowed while "strict subs" in use at eval.pl line 12.
Execution of eval.pl aborted due to compilation errors.
10 print "Hallo"
20 goto 10

View full thread windows attrib mit perl?