Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Comment on

( #3333=superdoc: 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/;?
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 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";}?

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=>"diary.pl?user=$user_key&diary_key=$ref->{'diary_key'}"

Happy Coding!

update:

# 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)

 
______crazyinsomniac_____________________________
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;"


In reply to (crazyinsomniac) Re: diary.pl by crazyinsomniac
in thread diary.pl by shockme

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others romping around the Monastery: (4)
    As of 2014-09-21 08:37 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (168 votes), past polls