Dicom-DCMTK-DCMQRSCP-Config
view release on metacpan or search on metacpan
# Object.
return $self;
}
# Parse configuration.
sub parse {
my ($self, $data) = @_;
$self->_default;
my $stay = 0;
foreach my $line (split m/\n/ms, $data) {
if ($line =~ m/^\s*#/ms || $line =~ m/^\s*$/ms) {
next;
}
if (($stay == 0 || $stay == 1)
&& $line =~ m/^\s*(\w+)\s*=\s*"?(\w+)"?\s*$/ms) {
$stay = 1;
$self->{'global'}->{$1} = $2;
# Begin of host table.
# End of host table.
} elsif ($stay == 2
&& $line =~ m/^\s*HostTable\s+END\s*$/ms) {
$stay = 1;
# Host in host table.
} elsif ($stay == 2
&& $line =~ m/^\s*(\w+)\s*=\s*\(([\d\.\w\s,]+)\)\s*$/ms) {
$self->{'host_table'}->{$1} = [split m/\s*,\s*/ms, $2];
# Symbolic names in host table.
} elsif ($stay == 2
&& $line =~ m/^\s*(\w+)\s*=\s*([\w\s,]+)\s*$/ms) {
$self->{'host_table_symb'}->{$1}
= [split m/\s*,\s*/ms, $2];
# Begin of AE table.
} elsif ($stay == 1 && $line =~ m/^\s*AETable\s+BEGIN\s*$/ms) {
$stay = 3;
# End of AE table
} elsif ($stay == 3 && $line =~ m/^\s*AETable\s+END\s*$/ms) {
$stay = 1;
# AE item.
} elsif ($stay == 3
&& $line =~ m/^\s*(\w+)\s+([\/\w]+)\s+(\w+)\s+\(([^)]+)\)\s+(.*)$/ms) {
my ($maxStudies, $maxBytesPerStudy)
= split m/\s*,\s*/ms, $4;
$self->{'ae_table'}->{$1} = {
'StorageArea' => $2,
'Access' => $3,
'Quota' => {
'maxStudies' => $maxStudies,
'maxBytesPerStudy' => $maxBytesPerStudy,
},
'Peers' => $5,
};
( run in 1.676 second using v1.01-cache-2.11-cpan-71847e10f99 )