|
|
| We don't bite newbies here... much | |
| PerlMonks |
(crazyinsomniac) Re: diary.plby crazyinsomniac (Prior) |
| on Feb 07, 2002 at 08:12 UTC ( #143814=note: print w/ replies, xml ) | Need Help?? |
|
I took a quick look at this, and I see a lot of familiar technique (you remind me of me) which I wouldn't employ now ;) I will now ask you a few similar questions, and hopefully get you thinking about what I mean.
Why do you include use CGI qw/:all/;?
Why do you include my $q = new CGI;?
Why do you include $q->param ?
Do you see a conflict of technique yet? I also see print("<center>"); and while it is understandable that you can't always say print center('stuff in here');, there is always print start_center,'stuff',end_center; (that trick only available if you're aware of use CGI qw/*center/; Some might argue performance when choosing between print("<center>"); and print start_center;, but my point is, either use the CGI.pm functional or OO interface, but don't mix. Also, if you do bother to 'import' :all the CGI functions, use them. Also, either stick to heredocs, or stick to CGI functions for generating html, don't mix. And probably the least important of my comments if (!($Found)) { if fine, but why did you choose to write it that way (probably cause it looks a lot like Java or c/c++ or something)? You are programming in perl now, and while some might argue that keeping things familiar helps you keep things straight, beginning to think in terms perlsyn helps you think of new solutions ( if (! $Found) { or if (not $Found) { or unless ($Found) { ). Consider this, if you wanted to iterate over an @array, how often would you write for(my $i=0;$i<90;$i++) {print $array[$i].$jerky."\n";}?
Think about it (but don't worry too much, after all, you at least have -wT -Mstrict in there ) :) However, you also might wanna look into CGI's escape, unescape, and escapeHTML functions, especially for this line -href=>"diary.pl?user=$user_key&diary_key=$ref->{'diary_key'}" Happy Coding! update: and this one is almost ridiculous, but $entry =~ s/\n/<P>/g; i feel might be more appropriately written as (yeah, I know, *almost*, who am I kidding ;D)
In Section
Code Catacombs
|
|
|||||||||||||||||||||