in reply to How Much Is Too Much (on one line of code)?

This is too much because thinking of how to say what it does out loud takes more than a couple of seconds. And yes, 'gbr' belongs elsewhere. And the uc() looks like maybe a display thing that should be in a template somewhere. Even the most naive and verbose rewrite I can think of scans easier for me:
our $DEFAULT_COUNTRY = 'gbr'; [...] my $country = $card->country; if ($country) { if ($country eq $DEFAULT_COUNTRY) { $country = ''; } else { $country = '[' . uc($country) . ']'; } }

Replies are listed 'Best First'.
Re^2: How Much Is Too Much (on one line of code)?
by Ovid (Cardinal) on Jun 18, 2007 at 12:49 UTC

    And the uc() looks like maybe a display thing that should be in a template somewhere.

    I didn't mention it, but this is in a Template Toolkit plugin, so this is a good spot for that behavior. Otherwise, that would have been a fantastic catch.

    Cheers,
    Ovid

    New address of my CGI Course.