Graph::Easy::Attributes - Define and check attributes for Graph::Easy
use Graph::Easy::Attributes; my $hexred = Graph::Easy::Attributes->color_as_hex( 'red' ); print Graph::Easy::Attributes->valid_attribute( 'color', 'red' );
Graph::Easy::Attributes contains the definitions of valid attribute names and values for Graph::Easy. It is used by both the parser and by Graph::Easy to check attributes. You shouldn't use it directly.
Graph::Easy::Attributes
my $new_value = Graph::Easy::Attributes->valid_attribute( $name, $value ); if (!defined $new_value) { # throw error die ("'$value' is not valid for attribute '$name'"); }
Check that a $name,$value pair is a valid attribute and return a new value.
$name,$value
The return value can differ from the passed in value, f.i.:
print Graph::Easy::Attributes->valid_attribute( 'color', 'red' );
This would print '#ff0000';
my $hexred = Graph::Easy::Attributes->color_as_hex( 'red' ); my $hexblue = Graph::Easy::Attributes->color_as_hex( '#0000ff' ); my $hexcyan = Graph::Easy::Attributes->color_as_hex( '#f0f' ); my $hexgreen = Graph::Easy::Attributes->color_as_hex( 'rgb(0,255,0)' );
Takes a valid color name or definition (hex, short hex, or RGB) and returns the color in hex like #ff00ff.
#ff00ff
Exports nothing.
Graph::Easy.
Copyright (C) 2004 - 2005 by Tels http://bloodgate.com
See the LICENSE file for information.
To install Graph::Easy, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Graph::Easy
CPAN shell
perl -MCPAN -e shell install Graph::Easy
For more information on module installation, please visit the detailed CPAN module installation guide.