in reply to Re: Warning for "unused sub declarations"?
in thread Warning for "unused sub declarations"?
A warning for subs that you declare but then don't use would be really annoying for those who are doing more advanced things behind-the-scenes. I might want to declare a subroutine name, but then define it at run-time.Indeed in the very same script I had
although I bet that many Perl hackers wouldn't regard this as a good practice.sub killp; *killp = DEBUG ? \&_killp_debug : \&_killp_real;
However we already do e.g.
all the time. A 'used only once' warning as suggested by someone else wouldn't be that bad after all.no strict 'refs'; # and no warnings 'uninitialized';
I don't run into this problem because I like parens that give perl a bit of extra help with the parsing (and keep maintenance programmers from getting too confused too).Well, that's to a very large extent a matter of personal preferences, just like so many other things in Perl. I find code having as few parentheses as possible to be best readable.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Warning for "unused sub declarations"?
by jonadab (Parson) on May 20, 2005 at 12:55 UTC | |
by Anonymous Monk on May 26, 2005 at 07:42 UTC | |
by jonadab (Parson) on May 26, 2005 at 10:50 UTC |