Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: System calls from CGI script

by shmem (Chancellor)
on Nov 04, 2016 at 23:52 UTC ( [id://1175339]=note: print w/replies, xml ) Need Help??


in reply to System calls from CGI script

my $cmd = sprintf("perl %s", $update_location); system($cmd);

You could avoid shelling out /bin/sh and a new instance of perl via require:

require $update_location;

This way your required script will also run with taint checking, which is always a good thing to do for CGI scripts (++ for the OP for that alone). Some points to be aware of:

  • $update_location must be an absolute path
  • it inherits globals from the current process
  • it must return a true value; this can be done by placing a line containing 1; at the end of the script $update_location
  • the invoking script MUST NOT be persistent (e.g. running under mod_perl or fastcgi) since requiring is done only once

This might fit - or not - your requirements; it is just another way to do it (and a safer one IMHO).

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Log In?
Username:
Password:

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

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

    No recent polls found