% include( '/elements/header.html', 'Developer Documentation' ) %> <& /elements/menubar.html, 'Freeside Perl Modules' => $fsurl.'docs/library/FS.html', 'Complete Index' => $fsurl.'docs/library/index.html', &>
FS::Misc::Getopt - Getopt::Std for Freeside command line/cron scripts
#!/usr/bin/perl
use FS::Getopt; use FS::other_stuff; our %opt;
getopts('AB');
print "Option A: $opt{A} Option B: $opt{B} Start date: $opt{start} End date: $opt{end} Freeside user: $opt{user} Verbose mode: $DEBUG ";
This module provides a wrapper around Getopt::Std::getopts() that automatically processes certain common command line options, and sets up a convenient environment for writing a script.
Options will go into %main::opt, as if you had called getopts(..., \%opt). All options recognized by the wrapper use (and will always use) lowercase letters as flags, so it's safe for a script to define its options as capital letters.
Options recognized by the wrapper do not need to be included in the string argument to getopts().
The following command line options are recognized:
Calling getopts() also performs some additional setup: