1) The Console/Getopt.php does not pass the static tests if you turn error reporting on. What the hell? Do the developers write code and ignore the errors or do they even have error reporting turned on?! The pimply bozo developers need some maturity. To get around this I turned on the error reporting after including their libraries and calling their code. These kids who developed the code need a father figure to guide them.
2) There are no robust code examples or documentation on the PEAR site for this library. These script kiddies couldn't be bothered apparently.
3) If upper or mixed case keywords are used their libraries blow up with recursive stack problems. So basically their code will make your code look totally unprofessional the first time the user makes a typo.
I was going to post some bugs on the PEAR site but I don't want to be associated with this product. Instead I'll put a routine together that runs daily to test the code. If the code ever gets updated I'll get notification when the script runs. In the meantime these bozos who developed the library will hopefully mature.
!/usr/bin/php -q
require_once 'Console/Getopt.php';
$short_opts = "hf::";
$long_opts = array('help', 'file==');
$con = new Console_Getopt;
$args = $con->readPHPArgv();
$prog = array_shift($args);
$options = $con->getopt2($args, $short_opts, $long_opts);
ini_set("display_errors", 'On');
error_reporting(E_ALL | E_STRICT);
print_r($options);
foreach ($options[0] as $option) {
printf("%3d %s=>%s\n", __LINE__, $options[0], $option);
switch ($option[0]) {
case 'h':
case '--help':
usage($prog);
break;
case 'f':
case '--file':
printf("%3d %s=>%s\n", __LINE__, $options[0], $option);
break;
}
}
function usage($prog) {
$usage = <<Usage: $prog [OPTIONS]
Serves as a skeleton example to be modified as needed
-f, --file=FILE Name of file
-h, --help Display usage
EOD;
fwrite(STDOUT,$usage);
exit(0);
}
?>
Make money online. The best hr outsourcing are available online at ICanFreelance
ReplyDelete