https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43560
--- Comment #1 from Martin Renvoize (ashimema) <[email protected]> --- Created attachment 206177 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206177&action=edit Bug 43560: Convert update_totalissues.pl to the Getopt::Long::Descriptive convention Convert the plain Getopt::Long option parsing to Koha::Script->describe_options, per the convention established by bug 43546. --since/--interval and --use-items/--incremental are declared via the exclusive support added on bug 43557, replacing the two hand-rolled "these are mutually exclusive" print+deferred-help checks. Also adds two Params::Validate callbacks (bug 43557's motivating use case for leaning on Getopt::Long::Descriptive's own validation machinery rather than hand-rolled checks): - --progress must be a positive integer. Previously an unchecked --progress 0 (or negative) would crash later with Perl's own "Illegal modulus zero" once the item/stats loop reached the modulo check, instead of failing immediately with a clear error. - --interval must be a number with an optional h/d/w/m/y suffix. Previously a malformed value (e.g. --interval abc) silently matched the parsing regex with an empty number, i.e. "subtract 0 of a day", and processed everything rather than failing. The "you must specify --use-stats and/or --use-items" check is an inclusive-or, not a mutual exclusion, so it has no declarative home in describe_options; kept as a plain post-parse check via $usage->die(), using the same short usage text every other error here now uses (the script previously dumped its full manual page via pod2usage(-verbose=>2) for every error, not just --man). This script has real POD already, so --man (added for free by describe_options) is genuinely useful here, unlike some of the other scripts converted so far. Test plan: 1. update_totalissues.pl --help / --man Confirm the description, all options, and the full manual page. 2. update_totalissues.pl (no options) Rejected: must specify --use-stats and/or --use-items. 3. update_totalissues.pl --use-stats --since X --interval Y Rejected: mutually exclusive. 4. update_totalissues.pl --use-items --incremental Rejected: mutually exclusive. 5. update_totalissues.pl --use-stats --progress 0 Rejected: must be a positive integer. 6. update_totalissues.pl --use-stats --interval abc Rejected: must be a number with an optional h/d/w/m/y suffix. 7. update_totalissues.pl --use-stats --test --interval 30d and --use-items --test both run to completion as before. 8. koha-qa.pl passes. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes. _______________________________________________ Koha-bugs mailing list -- [email protected] To unsubscribe send an email to [email protected] website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
