-my $usage = << 'ENDUSAGE';
-longoverdue.pl : This cron script set lost values on overdue items and optionally sets charges the patron's account
-for the item's replacement price. It is designed to be run as a nightly job. The command line options that globally
-define this behavior for this script will likely be moved into Koha's core circulation / issuing rules code in a
-near-term release, so this script is not intended to have a long lifetime.
+if ( $man ) {
+ pod2usage( -verbose => 2
+ -exitval => 0
+ );
+}
+
+if ( $help ) {
+ pod2usage( -verbose => 1,
+ -exitval => 0
+ );
+}
+
+if ( scalar @$borrower_category && scalar @$skip_borrower_category) {
+ pod2usage( -verbose => 1,
+ -message => "The options --category and --skip-category are mually exclusive.\n"
+ . "Use one or the other.",
+ -exitval => 1
+ );
+}
+
+if ( $list_categories ) {
+ my @categories = sort map { uc $_->[0] } @{ C4::Context->dbh->selectall_arrayref(q|SELECT categorycode FROM categories|) };
+ print "\nBorrowrer Categories: " . join( " ", @categories ) . "\n\n";
+ exit 0;
+}
+
+=head1 SYNOPSIS
+
+ longoverdue.pl [ --help | -h | --man | --list-categories ]
+ longoverdue.pl --lost | -l DAYS=LOST_CODE [ --charge | -c CHARGE_CODE ] [ --verbose | -v ] [ --quiet ]
+ [ --maxdays MAX_DAYS ] [ --mark-returned ] [ --category BORROWER_CATEGORY ] ...
+ [ --skip-category BORROWER_CATEGORY ] ...
+ [ --commit ]
+
+
+WARNING: Flippant use of this script could set all or most of the items in your catalog to Lost and charge your
+ patrons for them!
+
+WARNING: This script is known to be faulty. It is NOT recommended to use multiple --lost options.
+ See http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=2883
+
+=cut
+
+=head1 OPTIONS