It took me a second to understand that you are referring to the short-circuiting nature of //. If you needed the short-circuiting behaviour pre-5.10, here's one solution:
sub first(&@) {
my $cb = shift(@_);
for (@_) {
my $i = ref eq 'CODE' ? $_->() : $$_;
my $rv;
$rv = $cb->() for $i;
return $i if $rv;
}
return;
}
my $theme = first { defined }
\$global_config->{modes}{$current_mode}{theme},
\$theme_config->{current_theme},
\&ask_user,
\'none';
|