You don't need isa, you need can.
I often write code of which I assume that an object is able to execute certain methods. When in doubt, I try can() first, before actually calling the method. These classes do not need to be derived from a common class, that is an implementation detail to make virtual classes possible in languages like C++, for example. In Perl, when classes don't have common methods, it doesn't make sense to make them inherit from a common ancestor class.
I do assume that for those classes, methods of the same name serve a similar purpose, and have the same API. That may be a weak point. Likely so.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|