From: Tony Cook Date: Tue, 30 Oct 2007 08:16:24 +0000 (+0000) Subject: - attempt to work around the test failure at X-Git-Tag: Imager-0.61~8 X-Git-Url: http://git.imager.perl.org/imager.git/commitdiff_plain/ff37fc3f9fed8ff1f2670e3eb5062b25106cd10e?ds=sidebyside - attempt to work around the test failure at http://www.nntp.perl.org/group/perl.cpan.testers/2007/09/msg650810.html --- diff --git a/Changes b/Changes index ea0ad288..48c7e50a 100644 --- a/Changes +++ b/Changes @@ -44,6 +44,10 @@ Bug fixes: 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 =========== diff --git a/lib/Imager/Expr.pm b/lib/Imager/Expr.pm index 893a9ac0..06c77ad7 100644 --- a/lib/Imager/Expr.pm +++ b/lib/Imager/Expr.pm @@ -51,6 +51,12 @@ sub register_type { $expr_types{$name} = $pack; } +sub type_registered { + my ($class, $name) = @_; + + $expr_types{$name}; +} + sub _variables { return @{$_[0]->{variables}}; } @@ -574,7 +580,16 @@ expression object cannot be created. 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() diff --git a/t/t57infix.t b/t/t57infix.t index 3430c6ba..8c4d5d6b 100644 --- a/t/t57infix.t +++ b/t/t57infix.t @@ -1,15 +1,14 @@ #!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);