line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Acpi::Class::Devices; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$Acpi::Class::Devices::VERSION = '0.003'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
#ABSTRACT: Gives an ArrayRef with the directores in a folder. |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# use modules {{{ |
8
|
2
|
|
|
2
|
|
7085
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
82
|
|
9
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
99
|
|
10
|
2
|
|
|
2
|
|
2026
|
use Object::Tiny::XS qw{ dir pattern }; |
|
2
|
|
|
|
|
26513
|
|
|
2
|
|
|
|
|
14
|
|
11
|
2
|
|
|
2
|
|
1148
|
use Carp; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
411
|
|
12
|
|
|
|
|
|
|
# }}} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub devices #{{{ |
15
|
|
|
|
|
|
|
{ |
16
|
1
|
|
|
1
|
0
|
36
|
my $self = shift; |
17
|
1
|
|
|
|
|
5
|
my $dir = $self->dir; |
18
|
1
|
|
|
|
|
3
|
my $pattern = $self->pattern; |
19
|
1
|
50
|
|
|
|
123
|
opendir(my $device_dir, $dir) or croak "Cannot open $dir : $!"; |
20
|
1
|
|
|
|
|
3
|
my @devices; |
21
|
1
|
|
|
|
|
18
|
while(readdir($device_dir)) |
22
|
|
|
|
|
|
|
{ |
23
|
4
|
100
|
|
|
|
34
|
push @devices, $_ if ($_ =~ /$pattern/x); |
24
|
|
|
|
|
|
|
} |
25
|
1
|
|
|
|
|
14
|
closedir($device_dir); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# die "No elements found in $dir" unless (scalar @devices > 0); |
28
|
1
|
|
|
|
|
6
|
return \@devices; |
29
|
|
|
|
|
|
|
} #}}} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
__END__ |