Games::Maze::SVG - Build mazes in SVG.


Version 0.90


Games::Maze::SVG uses the Games::Maze module to create mazes in SVG.

    use Games::Maze::SVG;

    my $foo = Games::Maze::SVG->new();

See Games::Maze::SVG::Manual for more information on using the module.


new( $type, %parms )

Create a new Games::Maze::SVG object. Supports the following named parameters:

Takes one positional parameter that is the maze type: Rect, RectHex, or Hex


String naming the wall format. Legal values are bevel, round, roundcorners, and straight. Not all formats work with all maze shapes.


String describing the breadcrumb design. Legal values are dash, dot, line, and none


Directory in which to find the ecmascript for the maze interactivity. Should either be relative, or in URL form.


This parameter determines if the maze will be interactive. If the value of the parameter is true (1), the appropriate scripting and support is written into the SVG. If the parameter is omitted or false, no interactive support is provided.


The number of columns used in creating the maze. Default value is 12.


The number of rows used in creating the maze. Default value is 12.


The column where the entry is found. Default value is random.


The column where the exit is found. Default value is random.

$m->init_object( %parms )

Initializes the maze object with the default values for all mazes. The derived classes should call this method in their constructors.

Returns the initial data members as a list.


Method makes the maze interactive.

Returns a reference to self for chaining.

$m->set_breadcrumb( $bcs )


String specifying the breadcrumb style. Generates an exception if the breadcrumb style is not recognized.

Returns a reference to self for chaining.


Returns the CSS style for the breadcrumb.


Method that returns the path to the interactivity script.


Method that converts the current maze into an SVG string.


Alias for to_string to deal with inconsistent name from earlier versions.

$m->make_board_array( $rows )

Build a two-dimensional array of integers that maps the board from the two dimensional matrix of wall descriptions.


Returns a list of script URLs that will be needed by the interactive maze.


Generate the full set of script sections for the maze.

$m->build_board_element( $rows, $xp, $yp, $xe, $ye )

Create the element that describes the board.


reference to an array of rows.

$xp, $yp

Starting position

$xe, $ye

Ending position

$m->build_control_panel( $startx, $height )

Create the displayable control panel


the starting x coordinate for the panel


the height of the maze