develooper Front page | perl.perl5.porters | Postings from August 2012

Re: fixing smartmatch just hard enough (and when, too)

Thread Previous | Thread Next
Ricardo Signes
August 23, 2012 17:52
Re: fixing smartmatch just hard enough (and when, too)
Message ID:
* Leon Timmermans <> [2012-08-23T15:50:07]
> I suspect in practice junctions may be the only use-case for it. I
> can't think of any other use-case. I don't think it's a good idea to
> special case, TBH.

Check out autodie::exception.

  try {
    use autodie;
    open my $fh, '<', '/dev/fail';
  } catch {
    if ($_ ~~ 'open') { ... }

This behavior would fail without lhs overloading.  I'm not saying whether this
is a bad this, just now, but what's a programmer to do, here?  Overload eq?

So, I wanted to show that this is not only for junctions, and is already in
use, and to ask what you think of it.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About