our($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS, $AUTOLOAD);
require Exporter;
+require XSLoader;
@ISA = qw(Exporter);
-BEGIN {
- $VERSION = '1.09';
-}
+$VERSION = '1.09';
+
+XSLoader::load();
# Items to export into callers namespace by default
# (move infrequently used names to @EXPORT_OK below)
)],
);
-# Force the constants to become inlined
-BEGIN {
- require XSLoader;
- XSLoader::load();
-}
-
-sub S_IFMT { @_ ? ( $_[0] & _S_IFMT() ) : _S_IFMT() }
-
sub AUTOLOAD {
(my $constname = $AUTOLOAD) =~ s/.*:://;
die "&Fcntl::constant not defined" if $constname eq 'constant';
push @tests, ['CHR', $devnull, (stat $devnull)[2]];
}
-plan(tests => 6 + 9 * @tests);
+plan(tests => 34 + 6 + 9 * @tests);
foreach (@tests) {
my ($type, $name, $mode) = @$_;
is(scalar @warnings, 1, '1 warning');
like($warnings[0], qr/^Use of uninitialized value/, 'expected warning');
}
+
+is (S_IFMT(), _S_IFMT(), 'S_IFMT()');
+is (S_IFMT(0), 0, 'S_IFMT(0)');
+for my $shift (0..31) {
+ is (S_IFMT(1 << $shift), ((1 << $shift) & _S_IFMT()), "S_IFMT(1 << $shift)");
+}