Yes I could use SQLite, but maybe some users will upload it to a Unix server using FTP, and they won't be able to install easy DBD::SQLite on that server.
I don't think I make the perl code look like the code made in other languages, because I don't know too many languages. For example, I don't know C at all.
I know just a little Java and C#, but I don't like their style of coding because it involves too much code for doing very few things.
However, there ar more ways to do it in perl, so I use all kind of styles. Something I write: foreach(@array) { function($_); } but sometimes I write: function($_) foreach @array;I use to use not the most appropriate method always, but the one that comes to my mind earlier.
I think it is not very important if I use a method or another, and the speed difference between using for or foreach is practically 0.
Sometimes it is more clear if I use a block style but sometimes if too many blocks are involved, it is more clear to write some of them as a single line like in the example above and like in your second example.
Octavian----- Original Message ----- From: "Veli-Pekka Tätilä" <vtatila@xxxxxxxxxxxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx> Sent: Saturday, October 13, 2007 12:32 PMSubject: Re: Fruitbasket and Server-Side Perl (Was: FruitBasket Criteria Down)
Hi Octavian, As far as easy databases go, you could have used SQlLite, theoretically speaking. Saying: ppm i DBD-SQLite installs both the database and its DBD driver. 0 configuration needed. By the way, what I ment by idiomatic, in the other threadd, was if you made Perl look like Perl rather than some other language, because of better readability. One thing I personally dislike is watering down Perl to make it easier to read, or more like some other language out there. I do know you don't use the English module much, but recall reading tutorials which don't even let you know what the short variable names are. not that I'd be really worried, though, I just asked out of curiosity. Here's a quote from perlsyn to demonstrate: Quote: Here's how a C programmer might code up a particular algorithm in Perl: for (my $i = 0; $i < @ary1; $i++) { for (my $j = 0; $j < @ary2; $j++) { if ($ary1[$i] > $ary2[$j]) { last; # can't go to outer :-( } $ary1[$i] += $ary2[$j]; } # this is where that last takes me } Whereas here's how a Perl programmer more comfortable with the idiom might do it: OUTER: for my $wid (@ary1) { INNER: for my $jet (@ary2) { next OUTER if $wid > $jet; $wid += $jet; } } See how much easier this is? It's cleaner, safer, and faster. It's cleaner because it's less noisy. It's safer because if code gets added between the inner and outer loops later on, the new code won't be accidentally executed. The "next" explicitly iterates the other loop rather than merely terminating the inner one. And it's faster because Perl executes a "foreach" statement more rapidly than it would the equivalent "for" loop. End quote. Hope this helps. -- With kind regards Veli-Pekka Tätilä (vtatila@xxxxxxxxxxxxxxxxxxxx) Accessibility, game music, synthesizers and programming: http://www.student.oulu.fi/~vtatila Octavian Rasnita wrote:Hi,Ok, I've sent you to your personal address a rar file with 4 files; 2 are 2 versions of the FruitBasket CGI version made in perl, one is a version thatmanually prints the HTML code that need to be created, and one prints the same thing, but uses the CGI module functions. The other 2 files, in the "commented" dir, are the same files, but commented. Please add them all 4 in the same archive. Well, now I think I will also add a fifth file that describes them a a little.The perl code would have been very simple, but the hardest part was to store the list of all the fruits in a hidden field, then to restore them after theform is submitted, because I didn't want to store them on the server.It would have been much more simple if I'd put the program store them on theserver as most of the server side programs need to do anyway, but the problem is that the target directory must have had the necessarypermissions, or if I would have wanted to store them in a database I would have needed to specify the database connection, and the program wouldn't beable to run out of the box.__________ View the list's information and change your settings at //www.freelists.org/list/programmingblind
__________View the list's information and change your settings at //www.freelists.org/list/programmingblind