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

[PATCH 5.7.0] Re: Tests depending on extensions, and `make minitest'

Thread Previous | Thread Next
From:
John Tobey
Date:
January 3, 2001 12:42
Subject:
[PATCH 5.7.0] Re: Tests depending on extensions, and `make minitest'
Message ID:
m14DVL8-000FOoC@feynman.localnet
> Date: Sun, 31 Dec 2000 17:44:03 -0600
> From: Jarkko Hietaniemi <jhi@iki.fi>

> > t/op/my_stash.t uses Test, which uses Test::Harness, which uses
> > FileHandle, which uses IO as described above.
> 
> A-ha!  One reason why using Test::Harness to write the core tests
> isn't such a good idea.

The IO module has only a few XS functions.  Lots of code loads IO
without ever needing them.  Perhaps it should not fail for lack of XS?
Patch for bare 5.7.0...

-John

--- ext/IO/IO.pm	Tue Jan  2 12:19:09 2001
+++ ext/IO/IO.pm~	Sun Aug 13 14:33:35 2000
@@ -6,8 +6,7 @@
 use Carp;
 
 $VERSION = "1.20";
-# Use eval to avoid an unnecessary dependency on XS code.
-{ local $@; eval { XSLoader::load 'IO', $VERSION; }; }
+XSLoader::load 'IO', $VERSION;
 
 sub import {
     shift;
--- lib/IO/Seekable.pm	Tue Jan  2 12:18:31 2001
+++ lib/IO/Seekable.pm~	Sun Aug 13 14:33:35 2000
@@ -51,11 +51,7 @@
 use IO::Handle ();
 # XXX we can't get these from IO::Handle or we'll get prototype
 # mismatch warnings on C<use POSIX; use IO::File;> :-(
-BEGIN {
-    # Use eval to avoid an unnecessary dependency on the Fcntl extension.
-    local $@;
-    eval { require Fcntl; Fcntl->import (qw(SEEK_SET SEEK_CUR SEEK_END)); };
-}
+use Fcntl qw(SEEK_SET SEEK_CUR SEEK_END);
 require Exporter;
 
 @EXPORT = qw(SEEK_SET SEEK_CUR SEEK_END);
--- lib/FileHandle.pm	Tue Jan  2 12:20:43 2001
+++ lib/FileHandle.pm~	Sun Aug 13 14:34:13 2000
@@ -57,7 +57,7 @@
     for my $pkg (keys %import) {
 	for my $func (@{$import{$pkg}}) {
 	    my $c = *{"${pkg}::$func"}{CODE}
-		or next;
+		or die "${pkg}::$func missing";
 	    *$func = $c;
 	}
     }

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About