Subject: | The module runs out of colours for large tube networks |
Trying to produce a map from Map::Tube::Berlin will crash, complaining that
No color for line 'Street'. at D:\dl\Perl\tubemaps/C:/perl/site/lib/Map/Tube/GraphViz/Utils.pm line 71.
The Berlin map does not explicitly define the lines, and hence, no designated colours for the lines. Instead, the internal fallback using the array @COLORS is used, which has only highly finitely many entries. The above error message means, in effect, not "No colour was specified for line 'Street'", but rather "I cannot assign any colour to line 'Street'".
A simple way of circumventing this would be to recycle colours instead of balking, like so:
$obj->{'_color_index'} = ( $obj->{'_color_index'} + 1 ) % @COLORS;
in function color_line().