Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re^4: Should I leave behind beautiful code or readable code?

by perrin (Chancellor)
on Mar 29, 2007 at 15:53 UTC ( #607299=note: print w/replies, xml ) Need Help??

in reply to Re^3: Should I leave behind beautiful code or readable code?
in thread Should I leave behind beautiful code or readable code?

I realize that some perl coders can't seem to get out of bed in the morning without writing 5 map statements. The map is not that gratuitous here. The arrangement of the code though, with the buried uc() and the odd parentheses, is confusing. Here's a somewhat easier to read re-formatting:
return map { split(' ', uc $_, 2) } @somearray;
I might also break this into two, because the in-line makes the uncommon 3rd arg to split harder to pick up when scanning.
my @separated = map { split(' ', $_, 2) } @somearray; @separated = map { uc $_ } @separated;
Yes, it's probably slower. I don't care about the odd millisecond if it's easier to read. Some decent variable names would also make a big difference here.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://607299]
[moritz]: choroba in python I use jsonschema
[moritz]: I'm sure there's a Perl implementation of it too
[choroba]: it seems Kelp and similar help you a lot with dispatching, but how to do something similar with contents?
[moritz]: like JSON::Schema
[Corion]: ambrus++ # more bugs than lines
[Corion]: That's like "works on my machine" ;-)
[choroba]: I mean, I'd like to say "this path should run this sub, but first it should check the user is authenticated, has the following permissions, and the contents is valid against a given schema
[ambrus]: no, that means I haven't even tried to run it, might not even parse
[ambrus]: so it doesn't work on my machine
[choroba]: i.e. I know JSON::Schema, I'm just curious whether there's a ready solution to plug it into a web service

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (11)
As of 2016-12-08 12:51 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (141 votes). Check out past polls.