Skip to content
Browse files

Fix handling of code ref subs to allow for option=>\&Packagename::fun…

…ctionname.
  • Loading branch information...
1 parent fce7b84 commit 8e35797cb79a0f8bec5be7b36ecbc80aeb65db95 @lstein lstein committed Feb 16, 2012
Showing with 9 additions and 3 deletions.
  1. +3 −0 Changes
  2. +1 −1 lib/Bio/Graphics.pm
  3. +5 −2 lib/Bio/Graphics/FeatureFile.pm
View
3 Changes
@@ -1,5 +1,8 @@
Revision history for Perl extension Bio::Graphics.
+2.27
+ - Fix handling of code ref subs to allow for option=>\&Packagename::functionname.
+
2.26
- Support for normalizing quantitative plots across entire track.
- Support for transparency within tracks, allowing features to overlap.
View
2 lib/Bio/Graphics.pm
@@ -2,7 +2,7 @@ package Bio::Graphics;
use strict;
use Bio::Graphics::Panel;
-our $VERSION = '2.26';
+our $VERSION = '2.27';
1;
View
7 lib/Bio/Graphics/FeatureFile.pm
@@ -440,6 +440,7 @@ END
} else {
mkpath(dirname($cachefile));
my $parsed = $self->_new(@_);
+ $parsed->initialize_code();
eval {lock_store($parsed,$cachefile)};
warn $@ if $@;
return $parsed;
@@ -1167,10 +1168,12 @@ sub code_setting {
my $setting = $self->_setting($section=>$option);
return unless defined $setting;
return $setting if ref($setting) eq 'CODE';
- if ($setting =~ /^\\&(\w+)/) { # coderef in string form
+ if ($setting =~ /^\\&([:\w]+)/) { # coderef in string form
my $subroutine_name = $1;
my $package = $self->base2package;
- my $codestring = "\\&${package}\:\:${subroutine_name}";
+ my $codestring = $subroutine_name =~ /::/
+ ? "\\&$subroutine_name"
+ : "\\&${package}\:\:${subroutine_name}" ;
my $coderef = eval $codestring;
$self->_callback_complain($section,$option) if $@;
$self->set($section,$option,$coderef);

0 comments on commit 8e35797

Please sign in to comment.
Something went wrong with that request. Please try again.