# A.11 Answer for Chapter 12

#### A.11.1 Exercise (Section 12.12.1)

The module Oogaboogoo/date.pm looks like this:

```package Oogaboogoo::date;
use strict;
use Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(day mon);

my @day = qw(ark dip wap sen pop sep kir);
my @mon = qw(diz pod bod rod sip wax lin sen kun fiz nap dep);

sub day {
my \$num = shift @_;
die "\$num is not a valid day number"
unless \$num >= 0 and \$num <= 6;
\$day[\$num];
}

sub mon {
my \$num = shift @_;
die "\$num is not a valid month number"
unless \$num >= 0 and \$num <= 11;
\$mon[\$num];
}

1;```

The main program now looks like this:

```use strict;
use Oogaboogoo::date qw(day mon);

my(\$sec, \$min, \$hour, \$mday, \$mon, \$year, \$wday) = localtime;
my \$day_name = day(\$wday);
my \$mon_name = mon(\$mon);
\$year += 1900;
print "Today is \$day_name, \$mon_name \$mday, \$year.\n";```   Chapter 1. Introduction  Chapter 2. Building Larger Programs  Chapter 3. Introduction to References  Chapter 4. References and Scoping  Chapter 5. Manipulating Complex Data Structures  Chapter 6. Subroutine References  Chapter 7. Practical Reference Tricks  Chapter 8. Introduction to Objects  Chapter 9. Objects with Data  Chapter 10. Object Destruction  Chapter 11. Some Advanced Object Topics  Chapter 12. Using Modules  Chapter 13. Writing a Distribution  Chapter 14. Essential Testing  Chapter 15. Contributing to CPAN  Appendix A. Answers to Exercises  A.1 Answers for Chapter 2  A.2 Answers for Chapter 3  A.3 Answers for Chapter 4  A.4 Answers for Chapter 5  A.5 Answer for Chapter 6  A.6 Answers for Chapter 7  A.7 Answers for Chapter 8  A.8 Answer for Chapter 9  A.9 Answer for Chapter 10  A.10 Answer for Chapter 11  A.11 Answer for Chapter 12  A.12 Answers for Chapters 13-15