in reply to Perl OO Lint
Can't locate object method "caught" via package "My::Excpetion::Thingy +" (perhaps you forgot to load "My::Excpetion::Thingy"?) at script.pl +line 8.
True, it's a runtime error, but that's necessary since functions can be loaded at any time (including through AUTOLOAD) and @ISA can change at any time. Perl has no way of knowing at compile-time whether My::Excpetion::Thingy->caught will be valid any or all times that statement will be executed.
For example, I sometimes do:
if ($@) { require Carp; Carp::croak(...); }
Carp::croak doesn't exist until the require is executed, which is only executed at run-time when the exception occurs. A compile-time check would think this is an error. However, I'll cede that it could be useful for lint to give an (overridable) *warning*.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl OO Lint
by jffry (Hermit) on Mar 13, 2006 at 21:23 UTC | |
by ikegami (Patriarch) on Mar 13, 2006 at 23:13 UTC | |
by jffry (Hermit) on Mar 14, 2006 at 18:05 UTC |