|No such thing as a small change|
Re^2: Practical example of "Is Perl code maintainable"by xdg (Monsignor)
|on Aug 13, 2007 at 10:43 UTC||Need Help??|
There is "readable" and then there is "rambling and confusing"
At the cost of using a module, I'd go a bit further if readability were really the goal.
That's assuming I didn't have permission to replace whatever was calling file_mode with File::stat in the first place. Something is calling file_mode, storing the result, checking for -1, etc., etc. That part is probably just as crufty.
Update: ysth pointed out that I omitted '-f', so I re-wrote the code to be more explicit.
Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.