StorageDisplay
view release on metacpan or search on metacpan
lib/StorageDisplay/Collect.pm view on Meta::CPAN
}
my $self = {
_attr_cmdreader => $reader,
_attr_collectors => [],
_attr_collectors_by_provide => {},
};
bless $self, $class;
foreach my $cdata (@collectors) {
my $cn = $cdata->{name};
$cn->new($cdata, $self);
}
return $self;
}
sub registerCollectorModule {
my $class = shift;
my $collector = shift;
#my $collector = caller 0;
#print STDERR "Registering $collector from ".(caller 0)."\n";
lib/StorageDisplay/Collect.pm view on Meta::CPAN
foreach my $dev (@devs) {
$dh=$self->open_cmd_pipe_root('sas2ircu', $dev, 'DISPLAY');
my $l={};
my $state = 0;
my $wwid = {};
my $guid = {};
my $data = undef;
my $secdata = undef;
my $closure=sub {} ;
my $subclosure=sub {} ;
while(defined(my $line=<$dh>)) {
chomp($line);
next if $line =~ /^[\s-]*$/;
if ($line =~ /^(Controller) information$/
|| $line =~ /^(Enclosure) information$/) {
my $section = lc($1);
$subclosure->($data);
lib/StorageDisplay/Collect.pm view on Meta::CPAN
}
$l->{$section}=$curdata;
return {};
};
$state=10;
} elsif ($line =~ /^IR (Volume) information$/
|| $line =~ /^Physical (device) information$/) {
my $section = lc($1).'s';
$subclosure->($data);
$closure->($data);
$secdata=[];
$subclosure = sub { };
$closure=sub {
my $data = shift;
if (exists($l->{$section})) {
print STDERR "E: sas2ircu: duplicate section: $line\n";
}
$l->{$section}=$secdata;
return
};
} elsif ($line =~ /^IR volume ([^\s])+$/) {
my $name = $1;
$subclosure->($data);
$data = {
name => $name,
};
$subclosure = sub {
my $data = shift;
push @$secdata, $data;
};
} elsif ($line =~ /^Device is a Hard disk$/) {
$subclosure->($data);
$data = {};
$subclosure = sub {
my $data = shift;
push @$secdata, $data;
};
} elsif ($line =~ /^Initiator at ID .*$/) {
} elsif ($line =~ /^SAS2IRCU: .* Completed Successfully.$/) {
} elsif ($line =~ /^[^\s]/) {
if ($state != 0) {
print STDERR "W: sas2ircu: unknown line: $line\n";
}
} elsif ($line =~ /^\s+([^\s][^:]*[^\s])\s*:\s+([^\s].*)$/) {
my $k = $1;
my $v = $2;
( run in 0.282 second using v1.01-cache-2.11-cpan-454fe037f31 )