]> git.imager.perl.org - imager.git/commitdiff
more test entries
authorTony Cook <tony@develop=help.com>
Mon, 29 Nov 2004 10:00:56 +0000 (10:00 +0000)
committerTony Cook <tony@develop=help.com>
Mon, 29 Nov 2004 10:00:56 +0000 (10:00 +0000)
t/testtools.pl

index ad4886f97c3276046eb17025f48bac2d1a1d4299..e36d8073e70bf3e11db7698de5fd60ea30ac3596 100644 (file)
@@ -82,6 +82,27 @@ sub requireokx {
   }
 }
 
+sub useokx {
+  my ($module, $comment, @imports) = @_;
+  
+  my $pack = caller;
+  eval <<EOS;
+package $pack;
+require $module;
+$module->import(\@imports);
+EOS
+  unless (okx(!$@, $comment)) {
+    my $msg = $@;
+    $msg =~ s/\n+$//;
+    $msg =~ s/\n/\n# /g;
+    print "# $msg\n";
+    return 0;
+  }
+  else {
+    return 1;
+  }
+}
+
 sub matchn($$$$) {
   my ($num, $str, $re, $comment) = @_;