implementations.
http://rt.cpan.org/Ticket/Display.html?id=28985
+ - attempt to work around the test failure at
+ http://www.nntp.perl.org/group/perl.cpan.testers/2007/09/msg650810.html
+ http://rt.cpan.org/Ticket/Display.html?id=29562
+
Imager 0.60 - 30 August 2007
===========
$expr_types{$name} = $pack;
}
+sub type_registered {
+ my ($class, $name) = @_;
+
+ $expr_types{$name};
+}
+
sub _variables {
return @{$_[0]->{variables}};
}
Imager::Expr provides only a few simple methods meant for external use:
-=over 4
+=over
+
+=item Imager::Expr->type_registered($keyword)
+
+Returns true if the given expression type is available. The parameter
+is the key supplied to the new() method.
+
+ if (Imager::Expr->type_registered('expr')) {
+ # use infix expressions
+ }
=item $expr->code()
#!perl -w
use strict;
-use Test::More tests => 7;;
+use Test::More tests => 7;
BEGIN { use_ok('Imager::Expr') }
# only test this if Parse::RecDescent was loaded successfully
SKIP:
{
- eval "use Parse::RecDescent";
- $@
- and skip("No Parse::RecDescent", 6);
+ Imager::Expr->type_registered('expr')
+ or skip("Imager::Expr::Infix not available", 6);
my $opts = {expr=>'z=0.8;return hsv(x/w*360,y/h,z)', variables=>[ qw(x y) ], constants=>{h=>100,w=>100}};
my $expr = Imager::Expr->new($opts);