From: tla Date: Sat, 6 Dec 2014 21:54:58 +0000 (+0100) Subject: Stemweb job IDs no longer kill the parser. Fixes #28 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6e6d1e2db139d568f3f8440740a8b55de9ac96c6;p=scpubgit%2Fstemmatology.git Stemweb job IDs no longer kill the parser. Fixes #28 --- diff --git a/base/lib/Text/Tradition/Parser/Self.pm b/base/lib/Text/Tradition/Parser/Self.pm index 68cf6aa..17a6687 100644 --- a/base/lib/Text/Tradition/Parser/Self.pm +++ b/base/lib/Text/Tradition/Parser/Self.pm @@ -184,11 +184,13 @@ sub parse { my( $graph_data, $rel_data ) = graphml_parse( $opts ); my $collation = $tradition->collation; + my $tmeta = $tradition->meta; + my $cmeta = $collation->meta; + my %witnesses; # print STDERR "Setting graph globals\n"; $tradition->name( $graph_data->{'name'} ); - my $use_version; foreach my $gkey ( keys %{$graph_data->{'global'}} ) { my $val = $graph_data->{'global'}->{$gkey}; @@ -217,10 +219,23 @@ sub parse { } else { warn( "DROPPING user assignment without a specified userstore" ); } + # Is this key an attribute of the tradition or collation? + } elsif( $tmeta->has_attribute( $gkey ) ) { + my $attr = $tmeta->get_attribute( $gkey ); + warn( "Nonexistent tradition attribute $gkey" ) unless $attr; + my $method = $attr->get_write_method(); + $tradition->$method( $val ); + } elsif( $cmeta->has_attribute( $gkey ) ) { + my $attr = $cmeta->find_attribute_by_name( $gkey ); + warn( "Nonexistent collation attribute $gkey" ) unless $attr; + my $method = $attr->get_write_method(); + $collation->$method( $val ); + # Or is it an indirect attribute or other method? } elsif( $tradition->can( $gkey ) ) { $tradition->$gkey( $val ); } elsif( $collation->can( $gkey ) ) { $collation->$gkey( $val ); + # Nope? Oh well. } else { warn( "DROPPING unsupported attribute $gkey" ); }