WWW-USF-Directory
view release on metacpan or search on metacpan
lib/WWW/USF/Directory.pm view on Meta::CPAN
$tr_node->getChildrenByTagName('td');
# Make a hash with the headers as the keys
my %row = List::MoreUtils::mesh @{$table_header}, @row_content;
# Delete all keys with blank content
delete @row{grep { $row{$_} =~ m{\A \p{IsSpace}* \z}msx } keys %row};
if (exists $row{given_name}) {
# Split on vertical whitespace
my @given_names = split m{[\r\n]+}msx, $row{given_name};
# The first two given names are as follows
my ($first_name, $middle_name) = @given_names;
if (defined $first_name) {
# Set the first name
$row{first_name} = $first_name;
}
if (defined $middle_name) {
# Set the middle name
$row{middle_name} = $middle_name;
}
}
if (exists $row{affiliation}) {
# There could be zero or more affiliations seperated by vertical space
my @affiliations = split m{\s*[\r\n]+\s*}msx, delete $row{affiliation};
# Change the affiliation to objects
foreach my $affiliation (@affiliations) {
$affiliation = WWW::USF::Directory::Entry::Affiliation->new($affiliation);
}
# Store the affiliations
$row{affiliations} = \@affiliations;
}
( run in 0.426 second using v1.01-cache-2.11-cpan-71847e10f99 )