1################################################################################
2#
3#  Version 2.x, Copyright (C) 2007-2013, Marcus Holland-Moritz <mhx@cpan.org>.
4#  Version 1.x, Copyright (C) 1999, Graham Barr <gbarr@pobox.com>.
5#
6#  This program is free software; you can redistribute it and/or
7#  modify it under the same terms as Perl itself.
8#
9################################################################################
10
11use strict;
12use warnings;
13
14our %Config;
15BEGIN {
16  if ($ENV{'PERL_CORE'}) {
17    chdir 't' if -d 't';
18    @INC = '../lib' if -d '../lib' && -d '../ext';
19  }
20
21  require Test::More; Test::More->import;
22  require Config; Config->import;
23
24  if ($ENV{'PERL_CORE'} && $Config{'extensions'} !~ m[\bIPC/SysV\b]) {
25    plan(skip_all => 'IPC::SysV was not built');
26  }
27}
28
29my @pods;
30
31# find all potential pod files
32if (open F, "MANIFEST") {
33  chomp(my @files = <F>);
34  close F;
35  for my $f (@files) {
36    next if $f =~ /ppport/;
37    if (open F, $f) {
38      while (<F>) {
39        if (/^=\w+/) {
40          push @pods, $f;
41          last;
42        }
43      }
44      close F;
45    }
46  }
47}
48
49# load Test::Pod if possible, otherwise load Test::More
50eval {
51  require Test::Pod;
52  $Test::Pod::VERSION >= 0.95
53      or die "Test::Pod version only $Test::Pod::VERSION";
54  Test::Pod->import( tests => scalar @pods );
55};
56
57if ($@) {
58  require Test::More;
59  Test::More->import( skip_all => "testing pod requires Test::Pod" );
60}
61else {
62  for my $pod (@pods) {
63    pod_file_ok($pod);
64  }
65}
66
67