in reply to •Re: Re: •Re: Re: Say no to ref $thing eq "Expected::Type"
in thread Putting file contents into a scalar
Are they grinding you down today? Reusability is based first on usability. Ensuring that good code will interface with the most lousy code possible may be efficacious, but it is not maximizing reusability.1 Instead it's a way to prematurely embrittle the code.
When possible I avoid eval for errors which will be immediately handled.2 So to check if a param can do something, if it even is a blessed thing I'd use these terms in some conditional:
ref $it and $it=~/=/ and $it->can($meth) and $it->$meth();
2 The "throw" analogy for exceptions is appropriate: raise an exception when you can not handle the problem locally.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re: Re: •Re: Re: •Re: Re: Say no to ref $thing eq "Expected::Type"
by merlyn (Sage) on Oct 30, 2002 at 06:55 UTC | |
by dws (Chancellor) on Oct 30, 2002 at 07:39 UTC | |
by Aristotle (Chancellor) on Oct 30, 2002 at 13:05 UTC | |
by Anonymous Monk on Oct 30, 2002 at 08:45 UTC | |
by rir (Vicar) on Oct 30, 2002 at 19:15 UTC |