"Especially if in a particular sub you do ten method calls on your object — you've now replaced one param with ten function calls."
Not necessarily. If I know that I'm going to use the object 10 times in a specific sub, I can call get_handle() once and save the handle in my own variable throughout the sub.
sub z { my $handle=get_handle(); $handle->method_a('parameter'); $handle->method_b('parameter'); $handle->method_c('parameter'); # Etc. }
In reply to Re: Re: Avoiding global object handle
by Biker
in thread Avoiding global object handle
by Biker
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |