Chart::EPS_graph::Test.pm
Version 0.01
From the CLI, call as below where '/some/dir/'
is any directory you have
permission to write to.
perl -e "use Chart::EPS_graph::Test; \
print Chart::EPS_graph::Test->full_test('/some/dir');"
From anywhere else call...
use Chart::EPS_graph::Test;
print Chart::EPS_graph::Test->full_test(/some/dir);
With the parent module (Chart::EPS_graph.pm
) loaded, call as below. The
$foo
may be either class or instance (of module Chart::EPS_graph
) as it
will be ignored. The test module auto-instanciates its own object without need
of a new()
method. It is just a test, after all.
$foo->full_test('/some/dir');
Then look for both foo.eps
and foo.eps.png
to be created in /some/dir/
.
There is but a single method of interest as detailed in the synopsis above.
A special default is in effect if called without '/some/dir'
as an argument.
Then output will default to the /home/your_id
directory on UNIX or the
desktop in Win32 with only the foo.eps
(and not the foo.eps.png
) being
written there. This default behavior exists to allow for the module to be called
as a test when first building the module freshly downloaded from CPAN.
In the ordinary, user-diven, case (when /some/dir
is supplied as an argument)
then this module will allow itself a free hand to search for wherever it is that
Ghostscript and/or The GIMP have been installed. It calls the special Perl
module File::Find
to do this. It must because those programs may be installed
in various paths depending upon their version number.
But while being built as a brand new module freshly downloaded from CPAN, taint
mode will be in effect. This is a security precaution that disallows many an
unsafe condition. Taint mode will disallow that File::Find
be free to look
about where it likes. Thus, since at time of build we cannot know where
Ghostscript and The GIMP might be, and also cannot look for them, then
the test must do without them such that only foo.eps
and not foo.eps.png
may be created during the test.
For use only with the Chart::EPS_graph
module...as a full, user-like test
thereof.
How this test works is that two files, foo.eps
and foo.eps.png
will be
(over-)written into /some/dir/
. The test itself will inspect each of these
files for date, size and content. Based upon what it finds it will return a
string as its pronouncement on the health of Chart::EPS_graph
as a module.
That string will contain several lines, all of which should start with "Okay:"
and none of which should start with "Oops!".
Here is the output from calling this test module on the command line on NetBSD UNIX OS. If, as below, you specify a file path between the parens the output will be written there. Elsewise it will default to the user's home directory on UNIX or their desktop on Win32.
baal: {666} perl -e "use Chart::EPS_graph::Test; \
print Chart::EPS_graph::Test->full_test('/ram');"
Testing Chart::EPS_graph.pm in path '/ram'
Okay: File 'foo.eps' has expected first two lines.
Okay: File 'foo.eps' looks fresh: 0 seconds old.
Okay: File 'foo.eps' looks big enough, 28319 bytes.
Okay: Ghostscript created 'foo.eps.png'.
Okay: File 'foo.eps.png' looks fresh: 1 seconds old.
Okay: File 'foo.eps.png' looks big enough, 105828 bytes.
Glad Tidings! All tests okay for Chart::EPS_graph.
baal: {667}
Had there been a problem of any kind, one or more of the above lines would have
begun as Oops! ...
followed by a few terse details. You can also inspect the
example files personally via The GIMP or ImageMagick as you choose.
A few of my design-phase, run-time diagnostics remain but are commented out for the formal CPAN release so as not to impinge on general usage.
This module requires no configuration. It auto-searches for its dependencies
by calling to File::Find
.
My goal, as always, is OS-independence, but only have recources to design and test on these two platforms only:
Refer to POD of parent module Chart::EPS_graph
.
None known as yet.
None known as yet.
Gan Uesli Starling <gan@starling.us>
Copyright (c) 2006 Gan Uesli Starling. All rights reserved.
This is free software; you may distribute and/or modify it under the same terms as Perl itself.