Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

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

by sfink (Deacon)
on Jun 18, 2007 at 23:30 UTC ( #621890=note: print w/ replies, xml ) Need Help??


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

Way too much. It would almost be tolerable if it were:

my $country = $card->country; $country = $country eq 'gbr' ? '' : uc "[$country]" if $country;
but maybe that's just me. I always put postfix modifiers on their own line, indented, unless they are for control constructs. I find them much more digestible.

<tongue where='in-cheek'>
The proper way to do this would of course be something like:

my $country; eval { my $countryId = Country::Identifier->new(id => $card->country); $country = Country::Factory->new(id => $countryId); my $cntry_formatter = Formatter::Factory->new(action => sub { "[" . shift() . "]" }); $country->apply(Iterator->new(type => "closure", args => [ $cntry_formatter ])); }
but I don't have quite enough room left in the margin of this post for the error handling.
</tongue>


Comment on Re: How Much Is Too Much (on one line of code)?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2015-07-04 11:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (59 votes), past polls