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

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

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

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others chilling in the Monastery: (2)
    As of 2018-05-23 04:03 GMT
    Find Nodes?
      Voting Booth?