Doc Eng Logo
University of Nottingham CS
Home People Research


About This Document

Welcome to the first alpha release (v1.0) of SVG-PL, a Perl5 library for creating Scalable Vector Graphics (SVG) files. This document describes what SVG-PL is and the work currently being undertaken on the developement of this collection of Perl functions for producing SVG documents 'on the fly'.

The library is free for personal use, and commercial licences can be arranged. See the full licence agreement for further details.

For more information, some sexy examples, and the ability to download the library please visit the SVG-PL Official Homepage.


SVG-PL is a software library designed to assist in writing Perl programs for the creation of error-free SVG documents. The latest distribution can always be found at For a complete specification of SVG, see World Wide Web Consortium (W3C) Website at

Inevitably a simpler way to generate SVG files is to use software such as Adobe Illustrator® with an appropriate plug-in that would convert an image in an raster-only format into an SVG document. It might appear that generating an SVG drawing using a Perl program is doing it the hard way. But if an SVG document was expected to be the result of a World Wide Web (WWW) query, perhaps as the output of a Common Gateway Interface (CGI) program, then SVG-PL would serve as a vehicle to producing the document using Perl, which is commonly used in CGI programming.


SVG is a mark-up language for describing scalable, whilst keeping precision, two-dimensional graphics using the Extensible Markup Language (XML) notation. To be scalable means to increase or decrease uniformly, both in terms of pixel size in the graphics aspect, and number of files, users and applications in Web terms. There are three types of objects defined in SVG: vector graphic shapes (such as lines, curves and predefined shapes consisting of a number of paths), images and text. These graphical objects can be grouped, transformed, composited, styled and animated while scripting languages such as JavaScript can be used to trigger and enhance the animation effects. There are also event handlers, for example "onmouseup" and "onload", which can be assigned to the graphic objects for user interaction.

The SVG-PL library aims to serve as a collection of functions for the generation of SVG documents. The library functions were all written in Perl version 5 and thus SVG builders are expected to be reasonably familiar with the programming language itself since they will be writing Perl standalone programs which make use of such functions. As mentioned above, SVG-PL serves as a vehicle between Perl and SVG, therefore knowledge of the mark-up language is also assumed. Although familiarity with Perl and SVG is needed, builders however should not worry about validity of the SVG statements being generated since the library has functions defined to check syntax of the statements automatically. However error checking of user supplied data (attribute or parameter values) is not guaranteed, in other words semantics of data is not verified. SVG builders have to ensure that for instance co-ordinates of any graphic objects do not exceed the dimensions of the drawing they are in.

Current Status and Future Developments

Due to the fact that this is the first version of SVG-PL, limited functionality should not be seen as a surprise. For the most part the builders have to write Perl statements to customise graphics on the page. At the time of writing, SVG-PL does not perform syntax check on values to attributes such as "link", "transform", or the ones that accept JavaScript statements as value. Such features will be included in future releases of the software library.

Not all attribute values are checked before they are written to the SVG output. Those that the type or pattern of the input values that are unknown or uncertain have been left unchecked and are directly printed to the output stream. Verification checks for validity of such attribute values will be added in future releases of SVG-PL, along with graphic and text environment setting functions as mentioned earlier in the manual once the SVG specification has been finalised or becomes a W3C recommendation.

Moreover, there are currently no functions defined to manipulate or define values given to an SVG 'style' attribute in all corresponding tagsets where the attribute is allowed in. In addition, futher work is required to improve syntax checking algorithms as well as more error handling functionality.