- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Perl Poetry Contest, anyone?
Admin
Admin
Admin
Admin
I really hope that's a joke.
When are you going to get your language straight? ("your" "straight" "?")
Admin
Tu é que me deixas violentamente doente com as tuas quiquices e sintaxe.
Admin
The best practice way to do this in modern perl is this:
Not so scary huh?Admin
TRWTF is that this code is a classic tmpfile security vulnerability. It uses a well-known filename in /tmp. http://rute.2038bug.com/node47.html.gz#SECTION004714000000000000000
Admin
Why bash PHP?
I've written nice clean sites using Zend Framework and MySQL - everything done OO-style, no functions longer than about 10 lines, proper commenting everywhere - and then scaled them to millions of users per month (I'm not kidding, I've worked on some very high traffic sites, and you may have heard of at least some of them).
The people who took over from me only needed a few minutes of explanation on how things were set up - and then away they went. I've only had a few quick queries since.
Yes, I've seen some pretty bad PHP code, but nothing like the lousy examples of Perl (or C for that matter) that I've come across.
Admin
Verbing nouns is productive in English, so there really is nothing wrong with 'referencing'.
Admin
This is just a fairly extreme case of a very common antipattern that I see all the time, especially in Perl code (probably because Perl is used a lot as a scripting language by relatively inexperienced programmers).
The antipattern is that output of commands goes to files and input comes from files. No concepts of capturing output directly into memory, reading it from memory, or pipes. Commands operate on files, period.
Underlying this is a more general antipattern, which might be called large-scale assembly programming. In this programming style, everything that happens happens on variables, and the only complex data type that is known is the array. There are lots of sequences of for loops, each reading out an array and filling in a new array to be used by the next loop. Applied to files, this mode of thinking gives you sequences of steps, each reading a (temporary) input file and producing a (temporary) output file.
I think this is just an illustration of how programming concepts don't enter people's minds all at once. If it's a WTF at all, it's a WTF about teaching programming by starting out with C or BASIC.
Admin
You, Sir, have been trolled.
The wrong usage of "your", "you're" and similar in a post that is correcting other people's language is a bright flashing sign with the words "I am a troll." on this page.
Admin
Admin
We, as developers, need to make code more funnery to read
while (<COOKING>) { chop; @soup = split(/pea/,$_); }
Admin
I think the obvious point was that any language you don't know and whose goals you don't even know looks "bad" to you. It's like reading Russian when you can't speak the language or read the glyphs.
That said, there's (usually) a good reason why things are how they are in a language.
That program you criticise was written in the most well-known functional programming language in the world, emphasis on "functional". A functional is an abstraction of "function", like "function" is an abstraction of "relation". So of course it will take jumping through some hoops to achieve stuff that is wasn't designed for. But in return it can do things in a simple way you probably thought were impossible to do on a computer (i.e. handle infinitely long lists - and I don't mean that figuratively, but literally infinitely long).
As for the perl example, some people should think about the pronouns "it", "this", "that", ... in human language. Perl was written by a linguist to be similar to how humans understand "their" language (genetic language seed).
Admin
I hope this is a trollpost. Firstly, "reference" was used as a verb. Secondly, it can be either. Thirdly, you misspelled "straight" and wrote "your" wrong.
Admin
So your saying because it's easy to write code that kinda works it's a bad language?
Sounds like a good language to me.
Admin
man perlfunc search for time
HTH. HAND.
Admin
While it's not exactly pure perl, this only uses CORE libraries:
That incidentally follows the same time format definitions that the date command uses (which come from the POSIX C libraries, hence the name of the module.) It's also faster than shelling to unix/dos by a huge margin, as it's not doing a fork-exec-exec. (Even in the original version, perl runs sh to run date. And it doesn't specify an absolute path for either.)
Btw, I think you mean the DateTime module - I can't find a Date::Time module. DateTime is great when you need it, but really overkill most of the time. (If I were implementing a calendar, I'd absolutely use something like DateTime. If I'm just storing and reporting a few dates, no way.)
Admin
Perl is NOT ugly, it is beautiful.
Admin
On the plus side:
If you're going to be playing around a lot with dates and dealing with sometimes programmatically tricky concepts like "two weeks ago" and "next Friday", DateTime rocks. If you just need to know what day of the month it is, this is a working (if not ideal) solution.