in reply to Coding style: truth of variable name
I'm not sure how it works on MSWin, so maybe more portablyfor my $dir (glob '*/') {
for my $dir (grep -d, glob '*') {
The second case is different. I'd probably declare two subroutines:
I mean, it's not the responsibility of the "load" subroutine to convert the module name to its path. It's the caller's responsibility to know what they have and what they want to do with it.sub load_from_path { my ($module_path) = @_; # etc. } sub load_from_name { my ($module_name) = @_; my $module_path = ...; load_from_path($module_path); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Coding style: truth of variable name
by perlancar (Hermit) on Apr 19, 2020 at 02:00 UTC | |
by roboticus (Chancellor) on Apr 19, 2020 at 12:16 UTC | |
by davies (Monsignor) on Apr 19, 2020 at 18:03 UTC |