]> git.imager.perl.org - imager.git/commitdiff
- attempt to work around the test failure at
authorTony Cook <tony@develop=help.com>
Tue, 30 Oct 2007 08:16:24 +0000 (08:16 +0000)
committerTony Cook <tony@develop=help.com>
Tue, 30 Oct 2007 08:16:24 +0000 (08:16 +0000)
   http://www.nntp.perl.org/group/perl.cpan.testers/2007/09/msg650810.html

Changes
lib/Imager/Expr.pm
t/t57infix.t

diff --git a/Changes b/Changes
index ea0ad288169b50bd7466492b1b9ec4a0d85e4bc5..48c7e50ac0d7de423022fb2eee490836d6e3c9d8 100644 (file)
--- 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
 ===========
 
index 893a9ac0828dcfd16701799ee25ca418e0a14c48..06c77ad7d623e62d40ef019c9265a389feaa6cd1 100644 (file)
@@ -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()
 
index 3430c6bae7413a055aef6b39befd69b11c51fb5c..8c4d5d6b73060fcbe46bfb73ebe9e5783099ed8e 100644 (file)
@@ -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);