X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fstemmaweb%2FController%2FRelation.pm;h=89a7d23781e4d4c36bcbab077dce6ca737c025af;hb=2be76d3f155342740db9bf4653059c0cb119c2e6;hp=043a52f9b46800c3523e3494bfb8bf1aef752eb5;hpb=c53d6c7acaa65cd6b2b1139b540bc991fc972344;p=scpubgit%2Fstemmaweb.git diff --git a/lib/stemmaweb/Controller/Relation.pm b/lib/stemmaweb/Controller/Relation.pm index 043a52f..89a7d23 100644 --- a/lib/stemmaweb/Controller/Relation.pm +++ b/lib/stemmaweb/Controller/Relation.pm @@ -264,9 +264,9 @@ sub _reading_struct { # Return a JSONable struct of the useful keys. Keys meant to be writable # have a true value; read-only keys have a false value. my $struct = {}; - map { $struct->{$_} = $reading->$_ } keys( %read_write_keys ); + map { $struct->{$_} = $reading->$_ if $reading->can( $_ ) } keys( %read_write_keys ); # Special case - $struct->{'lexemes'} = [ $reading->lexemes ]; + $struct->{'lexemes'} = $reading->can( 'lexemes' ) ? [ $reading->lexemes ] : []; # Look up any words related via spelling or orthography my $sameword = sub { my $t = $_[0]->type;