Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

(crazyinsomniac) Re:

by crazyinsomniac (Prior)
on Feb 07, 2002 at 08:12 UTC ( #143814=note: print w/replies, xml ) Need Help??

in reply to

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/;?
What do you think the above code does?

Why do you include my $q = new CGI;?

Why do you include $q->param ?
Why do you include print <<END_FORM;?

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 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";}?

for my $i(@array) { print $i.$jerky."\n" } print $_.$jerky."\n" for @array; print shift(@array).$jerky."\n" while @array; print map $_.$jerky."\n", @array; print map { "${_}${jerky}\n" } @array;
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=>"$user_key&diary_key=$ref->{'diary_key'}"

Happy Coding!


# Another minor comment, sql statemends end in ; # so I try to end all mine in ;, and I always reccomend # others do as well (;) my $SQLText = qq[ UPDATE diary SET diary_title = ( ? ), diary_entry = ( ? ), fk_user_key = ( ? ) WHERE diary_key = ( ? );];
and this one is almost ridiculous, but $entry =~ s/\n/<P>/g; i feel might be more appropriately written as
$entry =~ s/\n\n/<P>/g; $entry =~ s/\n/<br>/g;
(yeah, I know, *almost*, who am I kidding ;D)

Of all the things I've lost, I miss my mind the most.
perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;"

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://143814]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2018-03-18 10:44 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (229 votes). Check out past polls.