Skip to content

Instantly share code, notes, and snippets.

@ilmari
Created December 13, 2012 17:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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