line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::Attributes::Extended; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
69267
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
57
|
|
4
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
59
|
|
5
|
2
|
|
|
2
|
|
8
|
use base 'File::Attributes::Base'; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
19678
|
|
6
|
|
|
|
|
|
|
use File::ExtAttr ':all'; |
7
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub priority { 6 }; |
10
|
|
|
|
|
|
|
sub applicable { |
11
|
|
|
|
|
|
|
my $self = shift; |
12
|
|
|
|
|
|
|
my $file = shift; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
eval { $self->get($file, 'perltest') }; |
15
|
|
|
|
|
|
|
return if $@; # can't use |
16
|
|
|
|
|
|
|
return 1; # can use |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub get { |
20
|
|
|
|
|
|
|
my $self = shift; |
21
|
|
|
|
|
|
|
my $file = shift; |
22
|
|
|
|
|
|
|
my $attr = shift; |
23
|
|
|
|
|
|
|
# make warnings fatal |
24
|
|
|
|
|
|
|
local $SIG{__WARN__} = sub { die "$_[0] ($!)" }; |
25
|
|
|
|
|
|
|
return getfattr($file, $attr); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub set { |
29
|
|
|
|
|
|
|
my $self = shift; |
30
|
|
|
|
|
|
|
my $file = shift; |
31
|
|
|
|
|
|
|
my $attr = shift; |
32
|
|
|
|
|
|
|
my $value= shift; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# make warnings fatal |
35
|
|
|
|
|
|
|
local $SIG{__WARN__} = sub { die "$_[0] ($!)" }; |
36
|
|
|
|
|
|
|
setfattr($file, $attr, $value); |
37
|
|
|
|
|
|
|
return 1; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub list { |
41
|
|
|
|
|
|
|
my $self = shift; |
42
|
|
|
|
|
|
|
my $file = shift; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
local $!; |
45
|
|
|
|
|
|
|
my @result = listfattr($file); |
46
|
|
|
|
|
|
|
die "Error listing attributes: $!" if !@result && $!; |
47
|
|
|
|
|
|
|
return @result; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub unset { |
51
|
|
|
|
|
|
|
my $self = shift; |
52
|
|
|
|
|
|
|
my $file = shift; |
53
|
|
|
|
|
|
|
my $attr = shift; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# make warnings fatal |
56
|
|
|
|
|
|
|
local $SIG{__WARN__} = sub { die "$_[0] ($!)" }; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
return delfattr($file, "$attr"); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
__END__ |