View on
MetaCPAN
Ivan Wills > SVG-Calendar > SVG::Calendar

Download:
SVG-Calendar-v0.3.12.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  1
View/Report Bugs
Module Version: v0.3.12   Source  

NAME ^

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

VERSION ^

This documentation refers to SVG::Calendar version 0.3.12.

SYNOPSIS ^

   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 with filenames
   #   my-calendar-2015-01.svg
   #   ...
   #   my-calendar-2015-12.svg
   $svg->output_year( '2007', 'my-calendar' );

DESCRIPTION ^

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

SUBROUTINES/METHODS ^

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

 flowers-2006-01.svg
 flowers-2006-02.svg
 ..
 flowers-2006-11.svg
 flowers-2006-12.svg

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.

Description:

  <path
     style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:0.25000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"
     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 "
     id="path1460"
     sodipodi:nodetypes="ccc" />
  <path
     style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:0.25000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"
     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 "
     id="path1464"
     sodipodi:nodetypes="csc" />
  <path
     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" />
  <circle
     style="fill: none; stroke: red; stroke-opacity: 0.5"
     cx="0"
     cy="100"
     r="100"
     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)

DIAGNOSTICS ^

CONFIGURATION AND ENVIRONMENT ^

DEPENDENCIES ^

INCOMPATIBILITIES ^

BUGS AND LIMITATIONS ^

There are no known bugs in this module.

Please report problems to Ivan Wills (ivan.wills@gmail.com).

Patches are welcome.

AUTHOR ^

Ivan Wills - (ivan.wills@gmail.com) <Author name(s)> (<contact address>)

LICENSE AND COPYRIGHT ^

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.

syntax highlighting: