I been reading through Perl Objects, References & Modules, one of the exercises asks for the creation of a library with two simple subs. The 2nd exercise then wants to use the library that was just created to print out the date. The model answer is as follows:
#!/usr/bin/perl -w
package Oogaboogoo::date;
use strict;
my @months = qw | diz pod bod rod sip wax lin sen kun fiz nap dep |;
my @days = qw | ark dip wap sen pop sep kir |;
sub day
{
my $num = shift @_;
die "$num is not a day number" unless $num >= 0 && $num <= 6;
$days[$num];
}
sub month
{
my $num = shift @_;
die "$num is not a month number" unless $num >= 0 && $num <= 11;
$months[$num];
}
1;
Heres the code for the 2nd exercise:
#!/usr/bin/perl -w
unshift @INC, 'C:\perlexamples\oorefmods\Oogaboogoo';
use strict;
require Oogaboogoo::date;
my ($sec, $min, $hour, $mday, $mon, $year, $wday) = localtime;
my $day_name = Oogaboogoo::date::day($wday);
my $mon_name = Oogaboogoo::date::month($mon);
$year += 1900;
printf "Today is the %s, %s %s, %s\n", $day_name, $mon_name, $mday, $year;
Whenever I try to run the 2nd exercise i get the following error:
---------- Capture Output ----------
> "C:\perl\bin\perl.exe" ex2-2.pl
Can't locate Oogaboogoo/date.pm in @INC (@INC contains: C:\perlexamples\oorefmods\Oogaboogoo C:/Perl/lib C:/Perl/site/lib .) at ex2-2.pl line 5.
> Terminated with exit code 2.
I'd appreciate any help I can get.
Thanks