First, the functions, SetAttributes and GetAttributes, must be specifically requested:
use Win32::File qw(:DEFAULT SetAttributes GetAttributes);
Second, since you're using
Win32::File, it doesn't do any good to try darwin. I eliminated darwin, and I deleted the eval. There was also a problem with &error_dialog being undefined, so I deleted that. Here's what I have
so far:
#!perl
BEGIN {
$| = 1;
$^W = 1;
}
use strict;
use warnings;
use Win32::File qw(
:DEFAULT
SetAttributes
GetAttributes
);
my $name = '/root/Desktop/foo.txt';
my $attr = 0;
Win32::File::SetAttributes( $name, $attr );
Win32::File::GetAttributes( $name, $attr );
if ( $attr & SYSTEM ) {
print "$name has SYSTEM set.\n";
}
if ( $attr & HIDDEN ) {
print "$name is hidden.\n";
}