File: test.pl

package info (click to toggle)
libio-dirent-perl 0.05-2
  • links: PTS
  • area: main
  • in suites: trixie
  • size: 84 kB
  • sloc: perl: 57; makefile: 4
file content (43 lines) | stat: -rw-r--r-- 883 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/local/bin/perl -w
use strict;
use Test;

BEGIN { plan tests => 5}
use blib;
use IO::Dirent qw(:ALL);
ok(1);

#open(FOO, ".");
#use Devel::Peek;
#Dump(*FOO);
#close FOO;
#print "=====================\n";

opendir DIR, ".";
#Dump(*DIR);
#print "=====================\n";

my @entries = readdirent(DIR);
closedir DIR;

for my $entry ( @entries ) {
    if( $entry->{'name'} eq 'blib' ) {
	skip( ! exists $entry->{'type'}, $entry->{'type'} == DT_DIR );
    }

    if( $entry->{'name'} eq 'Dirent.pm' ) {
	skip( ! exists $entry->{'type'}, $entry->{'type'} == DT_REG );
    }
}

opendir DIR, '.';
while( my $entry = nextdirent(DIR) ) {
    if( $entry->{'name'} eq 'blib' ) {
        skip( ! exists $entry->{'type'}, $entry->{'type'} == DT_DIR );
    }

    if( $entry->{'name'} eq 'Dirent.pm' ) {
	skip( ! exists $entry->{'type'}, $entry->{'type'} == DT_REG );
    }
}
closedir DIR;