Boldra has asked for the wisdom of the Perl Monks concerning the following question:
can be simplified tomy $home = defined( $args->{home} ) ? $args->{home} : defined($args->{house}) ? $args->{house} : confess(q{Can't determine home});
my $home = $args->{home} // $args->{house} // confess(q{Can't determin +e home});
Something that would let me write it something like this:my $home = $self->can('home') ? $self->home : $self->can('house') ? $self->house(1) : confess(q{Can't determine home});
?my $home = $self->cando('home') // $self->cando('house',1) // confess( +q{Can't determine home});
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: UNIVERSAL->cando , shortcut for testing and running methods?
by ikegami (Patriarch) on Mar 06, 2009 at 07:15 UTC | |
|
Re: UNIVERSAL->cando , shortcut for testing and running methods?
by Rhandom (Curate) on Mar 06, 2009 at 15:14 UTC |