Problems? Is your data what you think it is? | |
PerlMonks |
Re: Critque my second script for me?by Jazz (Curate) |
on Nov 18, 2001 at 00:50 UTC ( [id://126040]=note: print w/replies, xml ) | Need Help?? |
I agree with everything that Hero Zzyzzx and chromatic noted above. I'll just throw in my 2¢ worth of suggestions, for what it's worth :) No spaces between subs and opening parens.It may make your sub behave unexpectedly. For more info, check out this node. Use CGI.pm for everything you can (especially if you're already using CGI.pm).You've imported all of the standard fuctions, but are handrolling your HTML. For example, your bad_hacker_no_cookie has:
But you can tidy it up, use the functions you've already imported, and make sure it's valid html/xhtml code at the same time by using:
Variable naming and groupingI like to set my config vars (using mnemonic names) in either a hash or href. It helps me to identify them at a glance, especially when there are a lot of config settings. $mail, in a large program with lots of settings may be confusing (was that the contents of a message, the path to the mail program, the type of mailer to use, an email address, etc.), especially when you pick up the script to modify it in 6 months. But if you had <NOBR>$cfg->{'email_notices_to'}</NOBR>, you would know exactly was it was for and the data it contains :) Print from filehandle insteadIf you're just opening a file to be output to the browser, you don't need to toss the whole file into memory. Here's the code from your show_news sub:
Instead of this, you can use: Hope at least some of this helps, Jasmine
In Section
Seekers of Perl Wisdom
|
|