[Bioperl-l] How to get rid of warnings

Sendu Bala bix at sendu.me.uk
Sun Aug 20 03:10:35 EDT 2006


Hilmar Lapp wrote:
> 
> On Aug 19, 2006, at 2:07 PM, Sendu Bala wrote:
> 
>> Like I say, you have to have a default of undef and set the value to
>> undef to turn the feature off, which doesn't seem very nice to me.
> 
> Why? Typically a value of undef for a property (class or instance-level) 
> means it hasn't been set.
> 
> This is used all over the place, and I'm sure not just in bioperl.

Yes, but very very rarely are you ever required to deliberately pass 
'undef' as a value to a method in order to do something. Because that's 
quite a horrible thing to do.


>> I'd prefer to be able to chose a global verbosity level and
>> independently turn global behaviour on and off by supplying a method a
>> boolean or even the words 'on'|'off', not supplying int or undef.
> 
> You can do that too but I'm not sure about how much would be gained. If 
> I want to globally alter the verbosity, I will usually know why and 
> therefore to which level. I'm not sure how often the situation would 
> occur that I want to globally change the verbosity level, whatever the 
> system may think that should be. Typically I will want to dictate the 
> level too, not just switching it 'on' regardless of what the system 
> thinks I may mean by 'on'.

Like I say, you would also chose the specific level of verbosity you 
want. The 'on' is to turn on global behaviour of whatever verbosity you 
want.

So, perhaps:

# set variable Bio::Root::Root::VERBOSITY, which has no effect on
# anything in particular, except perhaps VERBOSITY is used as the
# default verbosity for Root instances that you don't manually set
# the verbosity of (in which case, most of the time this would
# seem like a global change)
Bio::Root::Root::verbose(-1);

# chose to make all instances behave as if they had a verbosity
# of -1 (ie. including the ones you had set to some specific
# verbosity and weren't still on default value - we have fine
# grained control over what we want with this system)
Bio::Root::Root::global_verbosity('on'); # or (1)

# chose to return behaviour to normal, instances behave like they
# had their set or default verbosity
Bio::Root::Root::global_verbosity('off'); # or (0)


The alternative is:
# set variable Bio::Root::Root::VERBOSITY and make all instances
# behave as if they had that verbosity
Bio::Root::Root::verbose(-1);

# chose to return behaviour to normal, instances behave like they
# had their set or default verbosity
Bio::Root::Root::verbose(undef);



More information about the Bioperl-l mailing list