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

NAME

SVG:SVG2zinc::Backend - a virtual class SVG:SVG2zinc svg reader. Sub-class are specialized for different type of generation

SYNOPSIS

package SVG:SVG2zinc::Backend::SubClass

use SVG:SVG2zinc::Backend;

## some methods definition

....

 ## when using a specialized backend:

 use SVG:SVG2zinc::Backend::SubClass;

 $backend = SVG:SVG2zinc::Backend::SubClass->new(
               -out => filename_or_handle,
               -in => svgfilename,
               -verbose => 0|1,
               [otheroptions],
               );

 $backend->fileHeader();

 $backend->treatLines("lineOfCode1", "lineOfCode2",...);

 $backend->comment("comment1", "comment2", ...);

 $backend->printLines("comment1", "comment2", ...);

 $backend->fileTail();

DESCRIPTION

SVG:SVG2zinc::Backend is a perl virtual class which should be specialized in sub-classes. It defines a common interface ot classes which can for example generate perl code with Tk::Zinc, display SVG file in a Tk::Zinc widget, convert svg file in image files (e.g. png) or generate tcl code to be used with TkZinc etc...

A backend should provide the following methods:

new

This creation class method should accept pairs of (-option => value) as well as the following arguments:

-out

A filename or a filehandle ready for writing the output. In same rare cases (e.g. the Display backend which only displays the SVG file on the screen, this option will not be used)

-in

The svg filename. It should be used in comments only in the generated file

-verbose

It will be used for letting the backend being verbose

fileHeader

Generates the header in the out file, if needed. This method should be called just after creating a backend and prior any treatLines or comment method call.

treatLines

Processes the given arguments as lines of code. The arguments are very close to Tk::Zinc perl code. When creating a new backend, using the Print backend can help understanding what are exactly these arguments.

comment

Processes the given arguments as comments. Depending on the backend, this method must be redefined so that arguments are treated as comments, or just skipped.

printLines

Print in an outfile the given arguments as lines of text. This method should not be re-defined, but used by any Backend which generates code.

fileTail

Generate the tail in the out file if needed and closes the out file. This must be the last call.

A backend can use the printLines method to print lines in the generated file.

SEE ALSO

SVG::SVG2zinc::Backend::Display(3pm), SVG::SVG2zinc::Backend::PerlScript(3pm), SVG::SVG2zinc::Backend::TclScript(3pm), SVG::SVG2zinc::Backend::PerlClass(3pm) code as examples of SVG::SVG2zinc::Backend subclasses.

SVG::SVG2zinc(3pm)

AUTHORS

Christophe Mertz <mertz at intuilab dot com> with some help from Daniel Etienne <etienne at cena dot fr>

COPYRIGHT

CENA (C) 2003-2004

This program is free software; you can redistribute it and/or modify it under the term of the LGPL licence.