catching errors with galleryadd.pl
vauneen
Joined: 2005-10-14
Posts: 8 |
Posted: Thu, 2006-01-05 08:47 |
i'm trying to catch errors when using galleryadd.pl. function doAddImage($imgname,$AID,$uName, $pword, $ftpdir ){ (i dont know perl) |
|
Posts: 5
Depends on what you mean by "errors". Looking briefly at the script for my first time, I see that it calls die() only if it cannot open its log file and it calls exit(1) in the event of a bunch of error conditions [actually, it calls PrintErr() which does an exit(1)].
So what you want to do in PHP is to check the result of the exec() call and see if the return code is 0 (i.e. no error) or non-zero (i.e. some kind of error). You'll need to look at the PHP documentation to figure out how to handle the exit code from an exec() call.
But, one thing to note is that if you know PHP coding, then you should be able to get the gist of this perl script. It is pretty straight forward and uses an "old school" perl style.
Hope this helps,
mG.