Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k & phranque

Message Too Old, No Replies

How to call an external script and get the error message (if any)?

...and should I be using do(), system(), backticks?

6:33 am on Apr 13, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

My web application has various *cgi files which call 'authenticate.pl' to make sure the user should really be able to execute the file. I've been calling that script with do('authenticate.pl'), but I just discovered that if an open() command in that script fails, the or die... part doesn't get written to the web browser. (Yes, I printed the content header.)

So do I need to do something special to make sure the error prints, or should I be using some other way of calling the authentication script in the first place, such as system() or backticks? I thought do was a "cleaner" way of calling external scripts (best practices, because less possibility of security issues), so that's why I started with that. But I'll switch if that's the best way to do it.

Software error:

Can't locate /home/deploy/webmasterworld/code_format-v6.lib in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at decode-post-v6.lib line 27, <THREADDAT> line 3.

For help, please send mail to the webmaster (it@imninjas.com), giving this error message and the time and date of the error.