Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: speeding up a script

by Fastolfe (Vicar)
on Dec 12, 2001 at 03:47 UTC ( [id://131104]=note: print w/replies, xml ) Need Help??


in reply to Speeding up a mailing list script

I think most of the other posts catch speed issues. I have a couple of things I wanted to suggest though:

  • use CGI or die;
  • use strict and warnings
  • The code print "Content-type: text/html \n\n fork failed: $!" unless defined $pid; could be re-written using CGI::Carp simply as: die "fork failed: $!" unless defined $pid;
  • The code open(LIST,"$in{'list_dir'}/$in{'list'}/$in{'list'}.txt"); introduces some very serious security issues. Use taint-checking (-T), read perlsec and maybe skim through Sanitizing user-provided path/filenames. I could pass "|/bin/rm -rf " as 'list_dir' and you would be hurting the next day.
  • Similarly, this is just as alarming: open (MAIL, "|$in{'mailprog'} -t");. Anyone can pass whatever command in 'mailprog' they want. You'd do better to specify this as a constant towards the top of your script.

Never trust the browser. Hope this helps.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://131104]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-19 06:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found