The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

UNIX::Cal - Perl wrapper for the original cal UNIX command line tool

SYNOPSIS

  use Data::Dumper;
  use UNIX::Cal;
  use UNIX::Cal qw(monday julian year);
 
  print Dumper(cal());

DESCRIPTION

UNIX::Cal is an implementation of good ol' UNIX command line cal.

It is really paying homage to the original code from The Regents of the University of California and Berkeley by Kim Letkeman.

As with UNIX cal, you can specify the switches to change the behaviour

use UNIX::Cal qw(monday); give the -m switch effect.

  -m  = monday  - set monday as the first day of the week
  -j  = julian  - generate the days in julian format
  -y  = year    - automatically create a years calendar

There is only one method - cal(). This method is pushed into the calling packages namespace, so it doesn't need to be fully qualified. cal() is called in three forms:

 cal();   - no arguments gives the current month unless -y was specified.
 cal(5, 2002); - returns the calendar for May, 2002.
 cal(2002); - returns the calendar ( each month ) for 2002.

The result of the cal() method is an array ref.

For a single months results: $VAR1 = [ [ 'May', 2002 ], [ 'Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa' ], [ '', '', '', 1, 2, 3, 4 ], [ 5, 6, 7, 8, 9, 10, 11 ], [ 12, 13, 14, 15, 16, 17, 18 ], [ 19, 20, 21, 22, 23, 24, 25 ], [ 26, 27, 28, 29, 30, 31, '' ] ];

The results for a year are like so: $VAR1 = [ [ 2002 ], [ [ 'January', 2002 ], [ 'Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa' ], [ '', '', 1, 2, 3, 4, 5 ], [ 6, 7, 8, 9, 10, 11, 12 ], [ 13, 14, 15, 16, 17, 18, 19 ], [ 20, 21, 22, 23, 24, 25, 26 ], [ 27, 28, 29, 30, 31, '', '' ] ], [ [ 'February', 2002 ], [ 'Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa' ], [ '', '', '', '', '', 1, 2 ], [ 3, 4, 5, 6, 7, 8, 9 ], [ 10, 11, 12, 13, 14, 15, 16 ], [ 17, 18, 19, 20, 21, 22, 23 ], [ 24, 25, 26, 27, 28, '', '' ] ], ...................

VERSION

very new

AUTHOR

Piers Harding

SEE ALSO

man cal