Tels > mediawiki-graph > README


Annotate this POD

View/Report Bugs

To better view this file, use:

        perldoc README

graphcnv ^

Take textual graph descriptions and turn them into nice drawings.

This package is intended to integrate Graph::Easy into Wikimedia, the software behind popular wikis like

For instance this input:

        [ Bonn ] -> [ Berlin ]
        [ Berlin -> [ Frankfurt ] { border: 1px dotted black; }
        [ Frankfurt ] -> [ Dresden ]
        [ Berlin ] -> [ Potsdam ]
        [ Potsdam ] => [ Cottbus ]

would be rendered in ASCII as:

        +------+     +--------+      .............     +---------+
        | Bonn | --> | Berlin |  --> : Frankfurt : --> | Dresden |
        +------+     +--------+      .............     +---------+
                     +---------+     +---------+
                     | Potsdam | ==> | Cottbus |
                     +---------+     +---------+

The HTML, SVG or PNG output would look similiar, except be more pretty :o)

This extension can output either inline "drawings" using HTML, Boxart or ASCII output, or create an external SVG file and then link it in.

In addition, it is possible to output graphviz code, and when you have graphviz (including dot) installed, you can generate PNG files.

Check the Signature ^

First you need to check the signature on the package to verify that it is untampered and intact. To do this you have to:

If the last step says "good signature" or "SIGNATURE VERIFIED OK", everything is all right.

Note that if you cpansign let GnuPG download my key from a keyserver, it might put a tels.asc file in the package directory, and then afterward complain that "tels.asc" is not in the MANIFEST:

 Not in MANIFEST: tels.asc
 ==> MISMATCHED content between MANIFEST and distribution files! <==

You can safely ignore this warning.

NOTE: Please notify me immidiately if the signature does not verify. In that case do NOT install this software, your system might get compromised!

Installation ^

Install the following Perl modules into your system:

        Graph-Easy-As_svg       (optional, for SVG output)

You can get these modules from

Afterwards, you should be able to run this on any command line:

        perl -MGraph::Easy\ 99

and it should report your installed Graph::Easy version (like v0.34).

        Graph::Easy version 99 required--this is only version 0.34.
        BEGIN failed--compilation aborted.

If it says something about "Graph::Easy" not being found, you need to install it first as root (see above!).

Note: You do NOT need to install Graph::Simple (the former name of Graph::Easy), nor Graph (formerly used by Graph::Easy). If they are already installed, that will not do any harm, however.

Installation on a shared host

On a shared host you typically do not have the rights to install Perl modules. An easy way around that limitation is to place the modules inside a directory called lib/ in the wiki/graph directory:

                \ - cgi-bin                     etc
                \ - wiki
                        \ - graph
                                \ - lib         <-- here
                        \ - extensions          etc

Untar Graph::Easy, Graph::Easy::As_svg and maybe Config::Tiny into this directory so that it looks like that:

        \ - wiki
                \ - graph
                        \ - lib
                                \ - Graph
                                        \ -
                                        \ - Layout      etc
                                \ - Config
                                        \ -     etc

Run the testsuite

If you are on a shared host, skip this step.

Otherwise, after installing the Perl modules from above into the system, then run in the directory of this package:

        perl Makefile.PL
        make test

All tests should pass. If not, please notify me.

Copy the files

Then place the contents of this mediawiki-graph.tar.gz file so that it is a subdirectory named 'graph' of your wiki installation like this:

                \ - cgi-bin                     etc
                \ - wiki
                        \ - graph               <-- here
                        \ - math                etc

You need the following files inside wiki/graph:

        graph.cfg               (there is a .sample file in the distribution)

Make a backup of your wiki directory! I repeat, MAKE A BACKUP! You have been warned!

Now copy all the files from the extensions/ subdirectory of graph to to the extension dir of your wiki, like so:

                \ - cgi-bin                     etc
                \ - wiki
                        \ - graph
                                \ - extensions  <-- from here
                        \ - extensions          <-- to here

At present this is only one file, Graph.php.

Then include the following line at the bottom of your LocalSettings.php, but before the "?>" line:


Manual test

Change the permissions of graphcnv to be executable:

        chmod a+x graph/graphcnv

Now you should be able to run manually (from your wiki directory):

        ./graph/graphcnv '[ Bonn ] -> [ Berlin ]' 'ascii'

and get a pretty ASCII art back on the console.

Wiki test

Finally you should be able to edit any page of the wiki and insert:

        [ Bonn ] -> [ Berlin ]

and hit preview.

If you get an error messages like:

        Error running graphcnv.

make sure that you followed the steps above correctly.


Inside the graph subdirectory there is a file called graph.cfg.sample. If you haven't done already, copy it to graph.cfg like so:

                \ - cgi-bin                     etc
                \ - wiki
                        \ - graph
                                graph.cfg.sample        <-- from here
                                graph.cfg               <-- to here

Then edit the graph.cfg file to your match your settings.

For more information please see or send me an email.


To enable SVG/PNG etc. output, you need to create a directory for the files that will be generated for the graphs. (Inlining the SVG code in the HTML page directly does not work, since no browser seesm to support this properly at this time).

The .svg (or .png) files are written to the output directory set in the config file, which defaults to ./images/graph/. So you need to make sure that this directory exists and is writable by the web server process:

                \ - cgi-bin                     etc
                \ - wiki
                        \ - images
                                \ - graph       <-- create this directory
                        \ - extensions          etc

You need also make sure that you web server process can write to this directory, so you might need to give it the same user/group as the process is using, f.i. chmod nobody.nogroup images/graph.


At the moment, each edit of a page containing a graph with SVG or PNG output results some of the time in one leaked file in the images/graph/ directory, e.g. there is a file created which is no longer referenced by any article. This happens when you delete articles with graphs in them or edit graphs heavily while using preview.

To stop the ever growing archive, you could simple delete all files and directories in that directory. Afterwards you might need to do null-edits on pages containing such diagrams. Although this also means you loose graphs embedded into older revisions, so this is not really recommended.

I am currently trying to find a way around that leak, or to clean up that directory.


Copyright (C) 2004 - 2006 by Tels

Contact: <> (literally :)

This library is free software; you can redistribute it and/or modify it under the same terms of the GPL version 2.

syntax highlighting: