Merge pull request #5230 from solgenomics/topic/open_pollinated
[sgn.git] / lib / SGN / View / Mason / CrossReference.pm
blob1cd211c8a5f3f6358ba17d0fd4ffa44701cf2b6e
1 package SGN::View::Mason::CrossReference;
2 use strict;
3 use warnings;
5 use Carp;
7 use base 'Exporter';
8 our @EXPORT_OK = qw( resolve_xref_component );
10 sub resolve_xref_component {
11 my ( $m, $feature, $comp_pattern ) = @_;
13 for my $fname ( $feature->feature_name, 'default' ) {
14 my $comp = $comp_pattern;
15 $comp =~ s/(?<!%)%f/$fname/g;
17 return $comp if $m->comp_exists( $comp );
20 croak "Cannot find Mason component for pattern '$comp_pattern' sitefeature ".$feature->feature_name;