dragonchild has asked for the wisdom of the Perl Monks concerning the following question:
Can anyone see that I missed anything? Are there any improvements I can make? Am I being too anal or DWIM-ish? Right now, I have no error messages back to the user. Is this a bad thing? As for the line-noise potential, this is the only place this logic will be used. (One idea, one place kind of thing.)my ($color, ...) = @_; $color ||= ''; my @colors = map { s/[^\d.-]//g; $_ ||= 0; $_ < 0 ? 0 : $_ / 255 } (split(/\s*,\s*/, $color, 4), (0) x 3)[0..2];
------
We are the carpenters and bricklayers of the Information Age.
Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.
Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DWIM on sub input
by halley (Prior) on Jul 16, 2003 at 14:22 UTC | |
by dragonchild (Archbishop) on Jul 16, 2003 at 14:31 UTC | |
by halley (Prior) on Jul 16, 2003 at 14:37 UTC | |
by dragonchild (Archbishop) on Jul 16, 2003 at 14:46 UTC | |
|
Re: DWIM on sub input
by broquaint (Abbot) on Jul 16, 2003 at 14:08 UTC | |
|
Re: DWIM on sub input
by Aristotle (Chancellor) on Jul 16, 2003 at 16:09 UTC | |
|
Re: DWIM on sub input
by Excalibor (Pilgrim) on Jul 16, 2003 at 16:01 UTC |