use XSLoader ();
-our $VERSION = "1.04" ;
+our $VERSION = "1.05" ;
# Grandfather old foo_h form to new :foo_h form
my $loaded;
goto &$AUTOLOAD;
}
+sub POSIX::SigAction::new {
+ bless {HANDLER => $_[1], MASK => $_[2], FLAGS => $_[3] || 0}, $_[0];
+}
+
+1;
+__END__
+
sub usage {
my ($mess) = @_;
croak "Usage: POSIX::$mess";
croak "Unimplemented: POSIX::$mess";
}
-############################
-package POSIX::SigAction;
-
-sub new {
- bless {HANDLER => $_[1], MASK => $_[2], FLAGS => $_[3] || 0}, $_[0];
-}
-
-############################
-package POSIX; # return to package POSIX so AutoSplit is happy
-1;
-__END__
-
sub assert {
usage "assert(expr)" if @_ != 1;
if (!$_[0]) {
ctype_h => [qw(isalnum isalpha iscntrl isdigit isgraph islower
isprint ispunct isspace isupper isxdigit tolower toupper)],
- dirent_h => [qw()],
+ dirent_h => [],
errno_h => [qw(E2BIG EACCES EADDRINUSE EADDRNOTAVAIL EAFNOSUPPORT
EAGAIN EALREADY EBADF EBUSY ECHILD ECONNABORTED
LDBL_MAX LDBL_MAX_10_EXP LDBL_MAX_EXP
LDBL_MIN LDBL_MIN_10_EXP LDBL_MIN_EXP)],
- grp_h => [qw()],
+ grp_h => [],
limits_h => [qw( ARG_MAX CHAR_BIT CHAR_MAX CHAR_MIN CHILD_MAX
INT_MAX INT_MIN LINK_MAX LONG_MAX LONG_MIN MAX_CANON
math_h => [qw(HUGE_VAL acos asin atan ceil cosh fabs floor fmod
frexp ldexp log10 modf pow sinh tan tanh)],
- pwd_h => [qw()],
+ pwd_h => [],
setjmp_h => [qw(longjmp setjmp siglongjmp sigsetjmp)],
SIG_IGN SIG_SETMASK SIG_UNBLOCK raise sigaction signal
sigpending sigprocmask sigsuspend)],
- stdarg_h => [qw()],
+ stdarg_h => [],
stddef_h => [qw(NULL offsetof)],
S_ISUID S_IWGRP S_IWOTH S_IWUSR S_IXGRP S_IXOTH S_IXUSR
fstat mkfifo)],
- sys_times_h => [qw()],
+ sys_times_h => [],
- sys_types_h => [qw()],
+ sys_types_h => [],
sys_utsname_h => [qw(uname)],
getpid getuid isatty lseek pathconf pause setgid setpgid
setsid setuid sysconf tcgetpgrp tcsetpgrp ttyname)],
- utime_h => [qw()],
+ utime_h => [],
);
}
require "./test.pl";
-plan(tests => 31);
+plan(tests => 38);
use POSIX qw(fcntl_h signal_h limits_h _exit getcwd open read strftime write
}
}
+SKIP: {
+ skip("no kill() support on Mac OS", 1) if $Is_MacOS;
+ is (eval "kill 0", 0, "check we have CORE::kill")
+ or print "\$\@ is " . _qq($@) . "\n";
+}
+
+# Check that we can import the POSIX kill routine
+POSIX->import ('kill');
+my $result = eval "kill 0";
+is ($result, undef, "we should now have POSIX::kill");
+# Check usage.
+like ($@, qr/^Usage: POSIX::kill\(pid, sig\)/, "check its usage message");
+
+# Check unimplemented.
+$result = eval {POSIX::offsetof};
+is ($result, undef, "offsetof should fail");
+like ($@, qr/^Unimplemented: POSIX::offsetof\(\) is C-specific/,
+ "check its unimplemented message");
+
+# Check reimplemented.
+$result = eval {POSIX::fgets};
+is ($result, undef, "fgets should fail");
+like ($@, qr/^Use method IO::Handle::gets\(\) instead/,
+ "check its redef message");
+
$| = 0;
# The following line assumes buffered output, which may be not true:
print '@#!*$@(!@#$' unless ($Is_MacOS || $Is_OS2 || $Is_UWin || $Is_OS390 ||