develooper Front page | perl.perl5.porters | Postings from August 2001

Re: [PATCH] new tests for the coderef-in-@INC

Thread Previous | Thread Next
Nicholas Clark
August 27, 2001 16:02
Re: [PATCH] new tests for the coderef-in-@INC
Message ID:
On Mon, Aug 27, 2001 at 10:36:27PM +0200, Rafael Garcia-Suarez wrote:
> I wrote some basic tests for the coderef-in-@INC feature.
> I placed them in a new file t/op/inccode.t (I also patched MANIFEST).

Brilliant. Thanks.

> Note : I use extensively the idiom
> 	open my $fh, '<', \$scalar
> in those tests, to return a new filehandle without using an external file.
> I hope it's OK.

It's not going to work on perl built to use stdio (not the default).
I guess it's easier to stick to using the idiom and just skip the test if
it's stdio. The appended patch does this.

Should I be getting a warning if perl is built without perlio and I attempt
to run a script using {open my $fh, '<', \$scalar} ?
Currently there don't seem to be any warnings.

Nicholas Clark

--- t/op/inccode.t.orig	Mon Aug 27 23:33:25 2001
+++ t/op/inccode.t	Mon Aug 27 23:47:07 2001
@@ -1,9 +1,16 @@
+#!./perl -w
 # Tests for the coderef-in-@INC feature
-chdir 't' if -d 't';
-@INC = '../lib';
+  chdir 't' if -d 't';
+  @INC = '../lib';
+use Config;
+unless ($Config{useperlio}) {
+  print "1..0 # Skipping (tests are implemented using perlio features, this perl uses stdio)\n";
+  exit 0;
 print "1..12\n";

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About