#!/usr/local/bin/perl
# bday - Birthday Machine
#
# Copyright 2015 David Meyer <
[email protected]> +JMJ
# (License and documentation at bottom of file.)
# Modules ###########################################################
use strict;
use warnings;
use Getopt::Std;
# Configuration #####################################################
our $PROGRAM = 'bday';
our $VERSION = '1.0';
our $AUTHOR = 'David Meyer <
[email protected]>';
our $BDDB = '.bddb';
# Globals ###########################################################
our (@dbuser, @dbactiv, @dbpriv, @dbyr, @dbmo, @dbday, %dbuidx);
# Functions #########################################################
sub HELP_MESSAGE {
my ($output, $optpkg) = @_;
print "This is the help message.\n";
}
sub VERSION_MESSAGE {
my ($output, $optpkg) = @_;
print "$PROGRAM Version $VERSION\n";
}
# Process arguments #################################################
our %options = ();
getopts('ghmuVp:', \%options);
if ($options{g}) {
print "option -g\n";
}
if ($options{h}) {
HELP_MESSAGE();
exit 0;
}
if ($options{m}) {
print "option -m\n";
}
if ($options{u}) {
print "option -u\n";
}
if ($options{V}) {
VERSION_MESSAGE();
exit 0;
}
if ($options{p}) {
print "option -p=$options{p}\n";
}
# Main driver #######################################################
$db = open($BDDB) or die "Can't open Birthday Database";
while (<$db>) {
my($user, $active, $priv, $year, $month, $day) = split / /, $_;
if (!defined($dbuidx{$user}) {
push @dbuser, $user;
push @dbactiv, $active;
push @dbpriv, $priv;
push @dbyr, $year;
push @dbmo, $month;
push @dbday, $day;
$dbuidx{$user} = $#dbuser;
}
exit 0
__END__
# Documentation #####################################################
=head1 NAME
bday - Birthday Machine
=head1 SYNOPSIS/USAGE
=head1 DESCRIPTION
Mark up code elements with C<>, file names with F<> (or C<> for
readability), command names with B<>. Also I<> for italics, U<> for
underline. Entities: E<lt> ('<'), E<gt> ('>').
=head1 OPTIONS
=item B<-o> I<value>, B<--option>=I<value>
=head1 RETURN VALUE
=head1 ERRORS
=head1 DIAGNOSTICS
=head1 EXAMPLES
=head1 ENVIRONMENT
=over 6
=item VARIABLE
Description of usage of environment variable C<VARIABLE>.
=back
=head1 FILES
=head1 BUGS, LIMITATIONS, AND CAVEATS
=head1 NOTES
=head1 AUTHOR
David Meyer <
[email protected]>
=head1 HISTORY
=head1 COPYRIGHT AND LICENSE
Copyright 201x David Meyer
=head1 SEE ALSO
# Emacs control #####################################################
#Local variables:
#mode: perl
#End: