Apache-GDGraph

 view release on metacpan or  search on metacpan

lib/Apache/GD/Graph.pm  view on Meta::CPAN

=back

ALL OTHER OPTIONS are passed to the corresponding set_<option> method, or the
set(<option hash>) method using the following rules for the values:jj

=over 8

=head1 DATA TYPES

=item B<undef>

Becomes a real undef.

=item B<[one,two,3]>

Becomes an array reference.

=item B<(one,two,3)>

This becomes a list, you can pass lists to set_SOMETHING methods of GD::Graph,
if there is no corresponding set_ method, the list will be silently converted
to an anonymous array and used in an ordinary option.

=item B<{one,1,two,2}>

Becomes a hash reference.

=item B<http://somewhere/file.png>

Is pulled into a file and the file name is passed to the respective option.
(Can be any scheme besides http:// that LWP::Simple supports.)

=item B<../fonts/arial.ttf>

Paths following this pattern will be interpreted as paths relative to
DocumentRoot of the web server.

=item B<gdSmallFont, gdLargeFont, gdMediumBoldFont, gdTinyFont, gdGiantFont,
	gdStyled, gdBrushed, gdStyledBrushed, gdTransparent>

These are reserved strings. If not quoted, they will be converted to the
builtin GD constants of the same name. See L<GD> for details.

=item B<[undef,something,undef] or {key,undef}>

You can create an array or hash with undefs.

=item B<['foo',bar] or 'baz' or {'key','value'}>

Single and double quoted strings are supported, either as singleton values or
inside arrays and hashes.

DON'T USE SPACES, this is a common mistake. A space in a URL-encoded string is
%20, or a + in a form.

=back

=cut

use strict;
use Data::Dumper;
use Apache;
use Apache::Constants qw/OK/;
use HTTP::Date;
use GD;
use GD::Text;
use GD::Graph;
use GD::Graph::colour qw(:convert);
use File::Cache;

use constant TRUE	=> 1;
use constant FALSE	=> 0;

use constant SECONDS_IN_DAY => 24 * 60 * 60;

use constant EXPIRES	=> 30;
use constant CACHE_SIZE	=> 5242880;
use constant IMAGE_TYPE => 'png';
use constant TTF_FONT_PATH	=> '/usr/ttfonts:/var/ttfonts:/usr/X11R6/lib/X11/fonts/ttf/:/usr/X11R6/lib/X11/fonts/truetype/:/usr/share/fonts/truetype';

use constant DEFAULT_TYPE	=> 'lines';
use constant DEFAULT_WIDTH	=> 400;
use constant DEFAULT_HEIGHT	=> 300;

use constant DEFAULT_CAPTION_BOX_OFFSET => 9;

use constant TYPE_UNDEF		=> 0;
use constant TYPE_SCALAR	=> 1;
use constant TYPE_ARRAY		=> 2;
use constant TYPE_HASH		=> 3;
use constant TYPE_URL		=> 4;
use constant TYPE_LIST		=> 5;

use constant STRIP_QUOTES => qr/(?:['"]|\%22)?	# First quote char, optional
				(.*)		# The main text.
				(?:['"]|\%22)	# Second quote char
				/x;

use constant ARRAY_OPTIONS => qw(
	dclrs borderclrs line_types markers types
);

use constant GD_CONSTANTS => {
	gdSmallFont	=> gdSmallFont,
	gdLargeFont	=> gdLargeFont,
	gdMediumBoldFont=> gdMediumBoldFont,
	gdTinyFont	=> gdTinyFont,
	gdGiantFont	=> gdGiantFont,
	gdStyled	=> gdStyled,
	gdBrushed	=> gdBrushed,
	gdStyledBrushed	=> gdStyledBrushed,
	gdTransparent	=> gdTransparent
};

# Sub prototypes:

sub init();
sub handler ($);
sub parse ($;$);
sub arrayCheck ($$);
sub error ($);



( run in 1.255 second using v1.01-cache-2.11-cpan-39bf76dae61 )