Barris, Wes | 3 Feb 2012 19:58
Favicon

Re: init_code syntax?

Zhiliang wrote onĀ 2012-02-02:

> I wish to re-use some codes in GBrowse configuration by putting them in
> "init_code" as in this 6 lines example:
> 
> init_code = sub processedTranscript_bgcolor {
>                 my $feature = shift;
>                 my $source = $feature->type;
>                 if ($source =~ /exon/) {return "#CCCCCC";}
>                 else                   {return "#33CC88";}
>             };

Your code is valid perl code.  However, because it is being parsed in
the config file the '#' characters are being treated as comment characters.
To fix this you will need to define your '#' characters using the 'chr'
function using syntax similar to this:

my $hash = chr(35);
     return "${hash}CCCCCC";

> However when I have these codes, the browser complains "server made a
> boo boo", and the apache error log shows:
> 
>   [Thu Feb 02 15:50:23 2012] [error] [client 184.41.213.57] MSG: syntax
>   error at line 97: 'init_code = sub processedTranscript_bgcolor {',
> When I comment out these 6 lines, the server resumes normal function.
> What could be the problem?
> 
> Thanks in advance,
> 
> Zhiliang
> 
> -----------------------------------------------------------------------
> ------- Keep Your Developer Skills Current with LearnDevNow! The most
> comprehensive online learning library for Microsoft developers is just
> $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro
> Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-d2d
> _______________________________________________ Gmod-gbrowse mailing
> list Gmod-gbrowse@...
> https://lists.sourceforge.net/lists/listinfo/gmod-gbrowse

--
Wes Barris

This email and any files transmitted with it are confidential and intended solely for the use of the
addressee. If you are not the intended addressee, then you have received this email in error and any use,
dissemination, forwarding, printing, or copying of this email is strictly prohibited. Please notify us
immediately of your unintended receipt by reply and then delete this email and your reply.
Cobb-Vantress, Inc. and its subsidiaries and affiliates will not be held liable to any person resulting
from the unintended or unauthorized use of any information contained in this email or as a result of any
additions or deletions of information originally contained in this email.

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2

Gmane