[Bioperl-l] How to get rid of warnings

Hilmar Lapp hlapp at gmx.net
Sun Aug 20 08:37:56 EDT 2006


Quite frankly I find nothing offending with passing undef to a  
method ... I do this all the time if I want to return a property to  
its virgin state. Conceptually it is like passing [] to a method that  
wants an array ref.

Hence, I do prefer the latter alternative, because it is simpler and  
doesn't involve having to introduce a new method solely for better  
control of the verbosity.

my $0.02 ...

	-hilmar

On Aug 20, 2006, at 3:10 AM, Sendu Bala wrote:

> 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);
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>

-- 
===========================================================
: Hilmar Lapp  -:-  Durham, NC  -:-  hlapp at gmx dot net :
===========================================================







More information about the Bioperl-l mailing list