| 1 | # | ||||||||||||||||||||||||||||
| 2 | # This file is part of StorageDisplay | ||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||
| 4 | # This software is copyright (c) 2014-2023 by Vincent Danjean. | ||||||||||||||||||||||||||||
| 5 | # | ||||||||||||||||||||||||||||
| 6 | # This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||
| 7 | # the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||
| 8 | # | ||||||||||||||||||||||||||||
| 9 | 9 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 9 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | package StorageDisplay::Block; | ||||||||||||||||||||||||||||
| 13 | # ABSTRACT: Base package for block devices DAG | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 9 | our $VERSION = '2.06'; # VERSION | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 9 | 1; | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | package StorageDisplay::BlockTreeElement; | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 9 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 9 | ▶ | use namespace::sweep; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 9 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 25 | 9 | ▶ | use StorageDisplay::Role; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 9 | with "StorageDisplay::Role::Iterable" | |||||||||||||||||||||||||||
| 28 | => { | ||||||||||||||||||||||||||||
| 29 | iterable => "StorageDisplay::BlockTreeElement", | ||||||||||||||||||||||||||||
| 30 | name => "Plain", | ||||||||||||||||||||||||||||
| 31 | }; | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 0 | ▶ | sub dname { | ||||||||||||||||||||||||||
|
Subroutine
dname: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 34 | 0 | my $self; | |||||||||||||||||||||||||||
| 35 | 0 | return $self->name; | |||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 9 | 1; | |||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | ################################################################## | ||||||||||||||||||||||||||||
| 41 | package StorageDisplay::Block; | ||||||||||||||||||||||||||||
| 42 | 9 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 43 | 9 | ▶ | use namespace::sweep; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 9 | extends 'StorageDisplay::BlockTreeElement'; | |||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 9 | ▶ | use Path::Class::Dir; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 9 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 9 | has 'names' => ( | |||||||||||||||||||||||||||
| 52 | traits => [ 'Hash' ], | ||||||||||||||||||||||||||||
| 53 | is => 'ro', | ||||||||||||||||||||||||||||
| 54 | isa => 'HashRef[Path::Class::Dir]', | ||||||||||||||||||||||||||||
| 55 | required => 1, | ||||||||||||||||||||||||||||
| 56 | handles => { | ||||||||||||||||||||||||||||
| 57 | 'addname' => 'set', | ||||||||||||||||||||||||||||
| 58 | 'names_str' => 'keys', | ||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||
| 60 | ); | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 9 | has 'path' => ( | |||||||||||||||||||||||||||
| 63 | is => 'rw', | ||||||||||||||||||||||||||||
| 64 | isa => 'Path::Class::Dir', | ||||||||||||||||||||||||||||
| 65 | required => 1, | ||||||||||||||||||||||||||||
| 66 | ); | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | 9 | has 'state' => ( | |||||||||||||||||||||||||||
| 69 | is => 'rw', | ||||||||||||||||||||||||||||
| 70 | isa => 'Str', | ||||||||||||||||||||||||||||
| 71 | default => 'unknown', | ||||||||||||||||||||||||||||
| 72 | lazy => 1, | ||||||||||||||||||||||||||||
| 73 | ); | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | 9 | has 'elem' => ( | |||||||||||||||||||||||||||
| 76 | is => 'ro', | ||||||||||||||||||||||||||||
| 77 | isa => 'StorageDisplay::Data::Elem', | ||||||||||||||||||||||||||||
| 78 | writer => '_elem', | ||||||||||||||||||||||||||||
| 79 | required => 0, | ||||||||||||||||||||||||||||
| 80 | ); | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | 986 | ▶ | sub provided { | ||||||||||||||||||||||||||
|
Subroutine
provided: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 83 | 986 | my $self = shift; | |||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | 986 | return defined($self->elem); | |||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 442 | ▶ | sub providedBy { | ||||||||||||||||||||||||||
|
Subroutine
providedBy: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 89 | 442 | my $self = shift; | |||||||||||||||||||||||||||
| 90 | 442 | my $elem = shift; | |||||||||||||||||||||||||||
| 91 | 442 | my $name = shift; | |||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | 442 | ▶ | if ($self->provided) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 94 | 0 | croak "Duplicate provider for ".$self->name.": ".$self->elem." and ".$elem; | |||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||
| 96 | #print STDERR "Provider for ".$self->name.": ".$elem."\n"; | ||||||||||||||||||||||||||||
| 97 | 442 | $self->_elem($elem); | |||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | 524 | ▶ | sub dname { | ||||||||||||||||||||||||||
|
Subroutine
dname: called CC=9 SCAR=22.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 101 | 524 | my $self = shift; | |||||||||||||||||||||||||||
| 102 | 524 | my $best_name=$self->name; | |||||||||||||||||||||||||||
| 103 | 524 | my $score = 0; | |||||||||||||||||||||||||||
| 104 | #print STDERR "name for ", $self->name, "\n"; | ||||||||||||||||||||||||||||
| 105 | #use Data::Dumper; | ||||||||||||||||||||||||||||
| 106 | #print STDERR Dumper($self->names), "\n"; | ||||||||||||||||||||||||||||
| 107 | 524 | foreach my $n ($self->names_str) { | |||||||||||||||||||||||||||
| 108 | 3207 | my $s=0; | |||||||||||||||||||||||||||
| 109 | 3207 | ▶ | if ($n =~ m,^disk/,) { | ||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||
| 110 | 2270 | $s = 20; | |||||||||||||||||||||||||||
| 111 | } elsif ($n =~ m,^dm-,) { | ||||||||||||||||||||||||||||
| 112 | 168 | $s = 30; | |||||||||||||||||||||||||||
| 113 | } elsif ($n =~ m,^mapper/,) { | ||||||||||||||||||||||||||||
| 114 | 168 | $s = 40; | |||||||||||||||||||||||||||
| 115 | } elsif ($n =~ m,/,) { | ||||||||||||||||||||||||||||
| 116 | 197 | $s = 60; | |||||||||||||||||||||||||||
| 117 | } else { | ||||||||||||||||||||||||||||
| 118 | 404 | $s = 50; | |||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||
| 120 | 3207 | ▶ | if ($s > $score) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 121 | #print STDERR " prefer($s) ", $n, "\n"; | ||||||||||||||||||||||||||||
| 122 | 1032 | $score = $s; | |||||||||||||||||||||||||||
| 123 | 1032 | $best_name = $n; | |||||||||||||||||||||||||||
| 124 | ▶ | } elsif ($s == $score && $n gt $best_name) { | |||||||||||||||||||||||||||
|
Condition100%3/3
$s == $score and $n gt $best_name
MC/DC100%2/2
$s == $score and $n gt $best_name
$s == $score
$n gt $best_name
Truth table100%3/3
A and B
A= $s == $scoreB= $n gt $best_name
| |||||||||||||||||||||||||||||
| 125 | #print STDERR " prefer($s/alpha) ", $n, "\n"; | ||||||||||||||||||||||||||||
| 126 | 215 | $best_name = $n; | |||||||||||||||||||||||||||
| 127 | #} else { | ||||||||||||||||||||||||||||
| 128 | # print STDERR " reject($s) ", $n, "\n"; | ||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | 524 | return '/dev/'. | |||||||||||||||||||||||||||
| 133 | $best_name; | ||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | has 'size' => ( | ||||||||||||||||||||||||||||
| 137 | is => 'rw', | ||||||||||||||||||||||||||||
| 138 | isa => 'Int', | ||||||||||||||||||||||||||||
| 139 | lazy => 1, | ||||||||||||||||||||||||||||
| 140 | 1 | ▶ | default => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 141 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 142 | 1 | confess "Method 'size' not implemented or set in ".ref($self)."@".$self->name; | |||||||||||||||||||||||||||
| 143 | #return -1; | ||||||||||||||||||||||||||||
| 144 | }, | ||||||||||||||||||||||||||||
| 145 | 9 | ); | |||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | 11 | ▶ | sub blk_info { | ||||||||||||||||||||||||||
|
Subroutine
blk_info: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 148 | 11 | my $self=shift; | |||||||||||||||||||||||||||
| 149 | 11 | my $key=shift; | |||||||||||||||||||||||||||
| 150 | 11 | return; | |||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||
| 153 | 11 | ▶ | sub udev_info { | ||||||||||||||||||||||||||
|
Subroutine
udev_info: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 154 | 11 | my $self=shift; | |||||||||||||||||||||||||||
| 155 | 11 | my $key=shift; | |||||||||||||||||||||||||||
| 156 | 11 | return; | |||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | ## function, not method | ||||||||||||||||||||||||||||
| 160 | 6 | ▶ | sub asname { | ||||||||||||||||||||||||||
|
Subroutine
asname: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 161 | 6 | my $block = shift; | |||||||||||||||||||||||||||
| 162 | 6 | my $blockname; | |||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | 6 | ▶ | if (blessed($block) && $block->isa("StorageDisplay::BlockTreeElement")) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($block) and $block->isa("StorageDisplay::BlockTreeElement")
MC/DC50%1/2
builtin::blessed($block) and $block->isa("StorageDisplay::BlockTreeElement")
builtin::blessed($block)
$block->isa("StorageDisplay::BlockTreeElement")
Truth table66%2/3
A and B
A= builtin::blessed($block)B= $block->isa("StorageDisplay::BlockTreeElement")
| |||||||||||||||||||||||||||||
| 165 | 3 | $blockname = $block->name; | |||||||||||||||||||||||||||
| 166 | } else { | ||||||||||||||||||||||||||||
| 167 | 3 | $blockname = $block; | |||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||
| 169 | 6 | return $blockname; | |||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | 9 | 1; | |||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | ################################################################## | ||||||||||||||||||||||||||||
| 175 | package StorageDisplay::Block::NoSystem; | ||||||||||||||||||||||||||||
| 176 | 9 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 177 | 9 | ▶ | use namespace::sweep; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | 9 | extends 'StorageDisplay::Block'; | |||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||
| 181 | 9 | has 'id' => ( | |||||||||||||||||||||||||||
| 182 | is => 'ro', | ||||||||||||||||||||||||||||
| 183 | isa => 'Str', | ||||||||||||||||||||||||||||
| 184 | required => 0, | ||||||||||||||||||||||||||||
| 185 | ); | ||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||
| 187 | 9 | has 'dname' => ( | |||||||||||||||||||||||||||
| 188 | is => 'ro', | ||||||||||||||||||||||||||||
| 189 | isa => 'Str', | ||||||||||||||||||||||||||||
| 190 | required => 1, | ||||||||||||||||||||||||||||
| 191 | ); | ||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||
| 193 | 9 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||
| 195 | 500 | ▶ | around BUILDARGS => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||
| 196 | 500 | my $orig = shift; | |||||||||||||||||||||||||||
| 197 | 500 | my $class = shift; | |||||||||||||||||||||||||||
| 198 | 500 | my %args = (@_); | |||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||
| 200 | 500 | ▶ | my $name = $args{'name'} // $args{'id'}; | ||||||||||||||||||||||||||
|
Condition66%2/3
$args{"name"} // $args{"id"}
MC/DC0%0/2
$args{"name"} // $args{"id"}
$args{"name"}
$args{"id"}
Truth table66%2/3
A // B
A= $args{"name"}B= $args{"id"}
| |||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | 500 | ▶ | my $dname = $args{'name'} // $args{'id'}; | ||||||||||||||||||||||||||
|
Condition66%2/3
$args{"name"} // $args{"id"}
MC/DC0%0/2
$args{"name"} // $args{"id"}
$args{"name"}
$args{"id"}
Truth table66%2/3
A // B
A= $args{"name"}B= $args{"id"}
| |||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||
| 204 | 500 | return $class->$orig( | |||||||||||||||||||||||||||
| 205 | 'name' => $name, | ||||||||||||||||||||||||||||
| 206 | 'dname' => $dname, | ||||||||||||||||||||||||||||
| 207 | 'names' => { $name => Path::Class::Dir->new() }, | ||||||||||||||||||||||||||||
| 208 | 'path' => Path::Class::Dir->new(), | ||||||||||||||||||||||||||||
| 209 | @_ | ||||||||||||||||||||||||||||
| 210 | ); | ||||||||||||||||||||||||||||
| 211 | 9 | }; | |||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | ################################################################## | ||||||||||||||||||||||||||||
| 214 | package StorageDisplay::Block::System; | ||||||||||||||||||||||||||||
| 215 | 9 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 216 | 9 | ▶ | use namespace::sweep; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | 9 | extends 'StorageDisplay::Block'; | |||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | 9 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||
| 222 | 9 | has '_blk_infos' => ( | |||||||||||||||||||||||||||
| 223 | is => 'ro', | ||||||||||||||||||||||||||||
| 224 | isa => 'HashRef', | ||||||||||||||||||||||||||||
| 225 | traits => [ 'Hash' ], | ||||||||||||||||||||||||||||
| 226 | required => 1, | ||||||||||||||||||||||||||||
| 227 | handles => { | ||||||||||||||||||||||||||||
| 228 | 'blk_info' => 'get', | ||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||
| 230 | ); | ||||||||||||||||||||||||||||
| 231 | 9 | has '_udev_infos' => ( | |||||||||||||||||||||||||||
| 232 | is => 'ro', | ||||||||||||||||||||||||||||
| 233 | isa => 'HashRef[Str]', | ||||||||||||||||||||||||||||
| 234 | traits => [ 'Hash' ], | ||||||||||||||||||||||||||||
| 235 | required => 1, | ||||||||||||||||||||||||||||
| 236 | handles => { | ||||||||||||||||||||||||||||
| 237 | 'udev_info' => 'get', | ||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||
| 239 | ); | ||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | 131 | ▶ | sub size { | ||||||||||||||||||||||||||
|
Subroutine
size: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 242 | 131 | my $self = shift; | |||||||||||||||||||||||||||
| 243 | 131 | return $self->blk_info('SIZE'); | |||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||
| 246 | 17 | ▶ | sub kname { | ||||||||||||||||||||||||||
|
Subroutine
kname: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 247 | 17 | my $self = shift; | |||||||||||||||||||||||||||
| 248 | 17 | return $self->blk_info('KNAME'); | |||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||
| 251 | 233 | ▶ | around BUILDARGS => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=8 SCAR=21.1
| |||||||||||||||||||||||||||||
| 252 | 233 | my $orig = shift; | |||||||||||||||||||||||||||
| 253 | 233 | my $class = shift; | |||||||||||||||||||||||||||
| 254 | 233 | my $name = shift; | |||||||||||||||||||||||||||
| 255 | 233 | my $st = shift; | |||||||||||||||||||||||||||
| 256 | 233 | my $blk_info = $st->get_info('lsblk', $name); | |||||||||||||||||||||||||||
| 257 | 233 | my %args; | |||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||
| 259 | 233 | ▶ | if ( @_ != 0 || ref $name ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@_ != 0 or ref $name
MC/DC0%0/2
@_ != 0 or ref $name
@_ != 0
ref $name
Truth table33%1/3
A or B
A= @_ != 0B= ref $name
| |||||||||||||||||||||||||||||
| 260 | 0 | croak "Invalid call to new"; | |||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||
| 262 | 233 | my $f; | |||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||
| 264 | 233 | my $udev_info = $st->get_info('udev', $name); | |||||||||||||||||||||||||||
| 265 | 233 | foreach my $k (keys %{$udev_info}) { | |||||||||||||||||||||||||||
| 266 | 932 | ▶ | if ($k eq 'path') { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 267 | 233 | $args{$k}=Path::Class::Dir->new($udev_info->{$k}); | |||||||||||||||||||||||||||
| 268 | } elsif ($k eq 'names') { | ||||||||||||||||||||||||||||
| 269 | 233 | $args{$k} = { map { $_ => Path::Class::Dir->new($_) } @{$udev_info->{$k}} }; | |||||||||||||||||||||||||||
| 270 | } else { | ||||||||||||||||||||||||||||
| 271 | 466 | $args{$k}=$udev_info->{$k}; | |||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||
| 275 | 233 | ▶ | if (defined($blk_info)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 276 | 233 | my %hash; | |||||||||||||||||||||||||||
| 277 | %hash = map { | ||||||||||||||||||||||||||||
| 278 | 233 | ▶ | if (defined($blk_info->{$_})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 279 | 8749 | uc $_ => $blk_info->{$_} | |||||||||||||||||||||||||||
| 280 | } else { | ||||||||||||||||||||||||||||
| 281 | () | ||||||||||||||||||||||||||||
| 282 | 4381 | } | |||||||||||||||||||||||||||
| 283 | } keys %$blk_info; | ||||||||||||||||||||||||||||
| 284 | 233 | $args{'_blk_infos'}=\%hash; | |||||||||||||||||||||||||||
| 285 | } else { | ||||||||||||||||||||||||||||
| 286 | 0 | croak "coucou"; | |||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||
| 289 | 233 | return $class->$orig( | |||||||||||||||||||||||||||
| 290 | %args, @_ | ||||||||||||||||||||||||||||
| 291 | ); | ||||||||||||||||||||||||||||
| 292 | 9 | }; | |||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||
| 294 | 9 | 1; | |||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||
| 296 | __END__ | ||||||||||||||||||||||||||||