note
tye
<blockquote><i><code>
my $class=ref($proto)||$proto;
</code></i></blockquote><p>
I understand the reasons to avoid this construct.
</p><p>
But if you avoid it, then you need to replace it with something. Unfortunately, although I often see this construct derided, I very seldom see suggestions for what to replace that line with (even when I come out and ask for it). The most straightforward replacement is unacceptable to me. See [id://301361] for why.
</p><p>
I also consider the objections to this to be rather minor in impact in a lot of practical situations and appreciate the "sloppy" advantages of <code>$obj->new()</code> in a lot of pracitcal situations. So I consider this construct to be a net win for <em>simple</em> OO <em>Perl</em> classes in many cases.
</p><p>
I also provide an alternative to it in [id://157074].
</p>
<div class="pmsig"><div class="pmsig-22609"><p align="right">
- [tye]<tt> </tt>
</p></div></div>
339131
339158