Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: How Much Is Too Much (on one line of code)?

by Limbic~Region (Chancellor)
on Jun 18, 2007 at 12:39 UTC ( #621776=note: print w/replies, xml ) Need Help??

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

I really don't think the second line is "too much" but it doesn't seem like a good idea either. It seems like the right thing to do would be to overload the country() method and abstract away the problem. Obviously that might not be possible given how country() is used elsewhere in the code.

An alternative might be:

my $country; if ($country = $card->country) { $country = $country eq 'gbr' ? '' : uc "[$country]"; }

Cheers - L~R

Replies are listed 'Best First'.
Re^2: How Much Is Too Much (on one line of code)?
by duckyd (Hermit) on Jun 21, 2007 at 02:35 UTC
    Since we're nitpicking a bit, I'll mention that I was wondering when this layout of the ternary operator would appear :)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://621776]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2018-10-15 12:30 GMT
Find Nodes?
    Voting Booth?
    When I need money for a bigger acquisition, I usually ...

    Results (82 votes). Check out past polls.