Usenet Forums

Usenet Forums (http://www.usenet-forums.com/)
-   RRD Users (http://www.usenet-forums.com/rrd-users/)
-   -   Re: [rrd-users] Problem with CDEFs, and question about PRINT (http://www.usenet-forums.com/rrd-users/339331-re-rrd-users-problem-cdefs-question-about-print.html)

Sam Umbach 04-24-2007 01:59 AM

Re: [rrd-users] Problem with CDEFs, and question about PRINT
 
David,

1) Instead of calling system() directly, save the command to a string
first and print it out. That will help you check if there are
problems with quotes or other shell special characters. If you're
still having a problem, post the command command line (with variables
substituted) and we can help diagnose the issue.

2) I highly discourage using the shell to parse commands in this way
(system() calls the shell if you give it a single string argument).
In the best case, it just creates confusion; in the worst case it
results in a security hole (if this is part of a CGI script, a remote
user may be able to execute arbitrary commands on your system as the
apache user). Instead, use the multi-argument form of system(); this
calls fork() and exec() and avoids the shell entirely.

3) If you want to capture STDOUT and/or STDERR from a command, have a
look at the following references. Backticks allow you to easily
capture STDOUT, but the shell will parse the command. Consider
instead:

http://search.cpan.org/~nwclark/perl...afe_Pipe_Opens
http://search.cpan.org/~dgold/Proc-R...16/Reliable.pm
http://search.cpan.org/~nwclark/perl...b/IPC/Open2.pm
http://search.cpan.org/~nwclark/perl...b/IPC/Open3.pm

The first reference will probably be sufficient for your needs, but
Proc::Reliable or IPC::Open2 may be easier to use.

-Sam

_______________________________________________
rrd-users mailing list
rrd-users@lists.oetiker.ch
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users


All times are GMT +1. The time now is 07:03 AM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0