NAME
Graph::Easy::Attributes - Define and check attributes for Graph::Easy
SYNOPSIS
use Graph::Easy::Attributes;
my $hexred = Graph::Easy::Attributes->color_as_hex( 'red' );
print Graph::Easy::Attributes->valid_attribute( 'color', 'red' );
DESCRIPTION
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.
METHODS
valid_attribute()
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.
The return value can differ from the passed in value, f.i.:
print Graph::Easy::Attributes->valid_attribute( 'color', 'red' );
This would print '#ff0000';
color_as_hex()
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
.
EXPORT
Exports nothing.
SEE ALSO
AUTHOR
Copyright (C) 2004 - 2005 by Tels http://bloodgate.com
See the LICENSE file for information.