in reply to Re: Avoiding global object handle
in thread Avoiding global object handle
If I have to call the get_handle() when I need it, I can appreciate that there's a performance cost. But pulling this handle through numerous calls to subs that don't need the handle themself, with the only reason to provide the handle to a 'sub-sub' feels as paying for something without getting anything in return.
Furthermore, imagine three subs named x(), y() and z(). sub x() calls sub y() that calls sub z().
One day sub z() is changed and needs access to the handle. As a result, the programmer must change sub x() and sub y() to take the handle as a parameter even though they couldn't care less about the handle themself.
This would lead to discussions like: "If we want to change sub z() to use the functionality of Module.pm, then we must first do an impact analyze to determine how many other subs must be enhanced to provide the handle, directly or indirectly, to our sub z()".
If sub z() can get a direct access to the handle, the change can be implemented in sub z() with no impact on other subs.
Yes, I'm talking about rather big and complex Perl applications here.
|
|---|