SVG::Calendar - Creates calendars in SVG format which can be printed


This documentation refers to SVG::Calendar version 0.3.0.


   use SVG::Calendar;

   # Brief but working code example(s) here showing the most common usage(s)
   # This section will be as far as many users bother reading, so make it as
   # educational and exemplary as possible.

   # Create a new (basic) SVG::Calendar object for producing A4 calendars
   my $svg = SVG::Calendar->new( page => 'A4' );

   # print to standard out the calendar for June 2006
   print $svg->output_month( '2006-06' );

   # create a calendar for the year 2007
   $svg->output_year( );


This module generates an SVG image for one or more months for a calendar.


new ( %args )

Arg: page - hash ref - description

Arg: moon - hash ref - description

Arg: image - hash ref - description

Arg: path - string - Directory containing alternate svg template version

Arg: inkscape - hash ref - Use inkscape to convert the SVG to a PDF or to print out the generated SVG calendar.

Return: SVG::Calendar - A new SVG::Calendar object

Description: Creates and sets up a new SVG::Calendar object

init ( )

Initialises the calendar object

get_page ( )

Return: hash - contains the page height and width and the units used

Description: Gets the dimensions of the page based on the parameters supplied at creation time

output_year ( ($start, $end | $year), $file )

Param: $start - string ('YYYY-MM') - description

Param: $end - string ('YYYY-MM') - description

Param: $year - int (year) - description

Param: $file - string - The base name for the SVG files calendars for each year

Return: list - A list of the files created

Description: Creates the SVG calendar files for each month of the year (or for each month from start and end)

 eg $svg->output_year( 2006, 'folowers' );

 Will result in the following files created


output_month ( $month, $file, )

Param: $month - string (detail) - The month that the calendar page should display (format YYYY-MM)

Param: $file - string (detail) - The file to save the output to if defined. if $file eq '-' prints to STDOUT

Return: string - The SVG text to display the calendar page

Description: Outputs a particular months calendar...

(Adds the week of the year and the

output ( $file )

Param: $file - string (detail) - The file name to print the SVG file to (if undefined it will print nothing)

Return: scalar - The SVG text.


     d="M 264.88031,225.97672 C 518.24408,341.14207 267.18361,490.85702 267.18361,490.85702 L 264.88031,225.97672 z "
     sodipodi:nodetypes="ccc" />
     d="M 628.80282,189.12380 C 854.52691,299.68254 847.54045,393.30582 626.49951,477.03718 C 579.56639,494.81567 769.30455,334.23215 628.80282,189.12380 z "
     sodipodi:nodetypes="csc" />
     style="fill: green; fill-opacity: 0.25; stroke: black;"
     d="M 0 0 C 133.3333 8, 133.3333 192, 0 200 C -133.333 192 -133.3333 8 Z"
        M 0 0 C 133.3333 8  133.3333 192, 0 200 C -133.333 192 -133.3333 8 Z
     id="test" />
     style="fill: none; stroke: red; stroke-opacity: 0.5"
     id="circle" />

moon ( %params )

Param: phase - float - 0 <= $phase < 2 * pi, represents the phase of the moon

Param: id - string - The id that the moon SVG part should use

Param: x - float - The X coordinate of the left hand side of the moon to be drawn

Param: y - float - The Y coordinate of the top side of the moon to be drawn

Param: r - float - The Radius of the the moon to be drawn

Return: SVG part - The SVG to display the moon in the phase passed in

Description: From the phase information this function calculates the details of the curve to represent the phase of the moon and puts it on the diagram based on the x, y and r parameters.

get_moon_phase ( $date )

Param: $date - date (DateTime object or string to convert to one) - The date that the moon phase is desired

Return: float - The phase of the moon from 0 (new moon) via 2 (full moon) to < 4 (next new moon)

Description: This method calculates the phase of the moon (it will what ever it can find to calculate the phase)


A list of every error and warning message that the module can generate (even the ones that will "never happen"), with a full explanation of each problem, one or more likely causes, and any suggested remedies.


A full explanation of any configuration system(s) used by the module, including the names and locations of any configuration files, and the meaning of any environment variables or properties that can be set. These descriptions must also include details of any configuration language used.


A list of all of the other modules that this module relies upon, including any restrictions on versions, and an indication of whether these required modules are part of the standard Perl distribution, part of the module's distribution, or must be installed separately.


A list of any modules that this module cannot be used in conjunction with. This may be due to name conflicts in the interface, or competition for system or program resources, or due to internal limitations of Perl (for example, many modules that use source code filters are mutually incompatible).


A list of known problems with the module, together with some indication of whether they are likely to be fixed in an upcoming release.

Also, a list of restrictions on the features the module does provide: data types that cannot be handled, performance issues and the circumstances in which they may arise, practical limitations on the size of data sets, special cases that are not (yet) handled, etc.

The initial template usually just has:

There are no known bugs in this module.

Please report problems to Ivan Wills (

Patches are welcome.


Ivan Wills - ( <Author name(s)> (<contact address>)


Copyright (c) 2006-2009 Ivan Wills (14 Mullion Close, Hornsby Heights, NSW Australia 2077) All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.