From: Tara L Andrews Date: Wed, 11 Jul 2012 10:08:37 +0000 (+0200) Subject: some syntactic sugar for relationship filters X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d002ccb7c139c88b3cb904d5e27c5c056241d76f;p=scpubgit%2Fstemmatology.git some syntactic sugar for relationship filters --- diff --git a/lib/Text/Tradition/Collation/RelationshipStore.pm b/lib/Text/Tradition/Collation/RelationshipStore.pm index aeb8b7f..0ee51ab 100644 --- a/lib/Text/Tradition/Collation/RelationshipStore.pm +++ b/lib/Text/Tradition/Collation/RelationshipStore.pm @@ -717,6 +717,9 @@ sub related_readings { # Backwards compat if( $filter eq 'colocated' ) { $filter = sub { $_[0]->colocated }; + } elsif( !ref( $filter ) ) { + my $type = $filter; + $filter = sub { $_[0]->type eq $type }; } my %found = ( $reading => 1 ); my $check = [ $reading ];