Skip to content

Instantly share code, notes, and snippets.

@ilmari
Created December 13, 2012 17:39
Show Gist options
  • Save ilmari/4278187 to your computer and use it in GitHub Desktop.
Save ilmari/4278187 to your computer and use it in GitHub Desktop.
suggested ternary wrapping
my %types = map {
my $t = defined($params->{"${_}_type"}) ? $params->{"${_}_type"}
: is_blessed($params->{$_}) ? $params->{$_}->item_type
: defined($params->{$_}) && @{$params->{$_}} ? $params->{$_}->[0]->item_type
: undef;
defined($t) ? ($_ => $t) : ()
} qw(container containee);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment