~ubuntu-branches/ubuntu/vivid/horae/vivid

« back to all changes in this revision

Viewing changes to 0CPAN/Pod-Simple-3.03/t/00about.t

  • Committer: Bazaar Package Importer
  • Author(s): Carlo Segre
  • Date: 2006-12-26 11:54:29 UTC
  • Revision ID: james.westby@ubuntu.com-20061226115429-kjuhf6h9w6bohlwj
Tags: upstream-063
ImportĀ upstreamĀ versionĀ 063

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
require 5;
 
3
# Time-stamp: "2004-05-23 19:48:32 ADT"
 
4
 
 
5
# Summary of, well, things.
 
6
 
 
7
use strict;
 
8
use Test;
 
9
my @modules;
 
10
BEGIN {
 
11
  @modules = qw(
 
12
 
 
13
Pod::Escapes
 
14
 
 
15
Pod::Simple     
 
16
Pod::Simple::BlackBox   Pod::Simple::Checker    Pod::Simple::DumpAsText
 
17
Pod::Simple::DumpAsXML  Pod::Simple::HTML       Pod::Simple::HTMLBatch
 
18
Pod::Simple::HTMLLegacy Pod::Simple::LinkSection        Pod::Simple::Methody
 
19
Pod::Simple::Progress   Pod::Simple::PullParser
 
20
Pod::Simple::PullParserEndToken Pod::Simple::PullParserStartToken
 
21
Pod::Simple::PullParserTextToken        Pod::Simple::PullParserToken
 
22
Pod::Simple::RTF        Pod::Simple::Search     Pod::Simple::SimpleTree
 
23
Pod::Simple::Text       Pod::Simple::TextContent        Pod::Simple::TiedOutFH
 
24
Pod::Simple::Transcode  Pod::Simple::XMLOutStream
 
25
 
 
26
  );
 
27
  plan tests => 2 + @modules;
 
28
};
 
29
 
 
30
ok 1;
 
31
 
 
32
#chdir "t" if -e "t";
 
33
foreach my $m (@modules) {
 
34
  print "# Loading $m ...\n";
 
35
  eval "require $m;";
 
36
  unless($@) { ok 1; next }
 
37
  my $e = $@;
 
38
  $e =~ s/\s+$//s;
 
39
  $e =~ s/[\n\r]+/\n# > /;
 
40
  print "# Error while trying to load $m --\n# > $e\n";
 
41
  ok 0;
 
42
}
 
43
 
 
44
{
 
45
  my @out;
 
46
  push @out,
 
47
    "\n\nPerl v",
 
48
    defined($^V) ? sprintf('%vd', $^V) : $],
 
49
    " under $^O ",
 
50
    (defined(&Win32::BuildNumber) and defined &Win32::BuildNumber())
 
51
      ? ("(Win32::BuildNumber ", &Win32::BuildNumber(), ")") : (),
 
52
    (defined $MacPerl::Version)
 
53
      ? ("(MacPerl version $MacPerl::Version)") : (),
 
54
    "\n"
 
55
  ;
 
56
 
 
57
  # Ugly code to walk the symbol tables:
 
58
  my %v;
 
59
  my @stack = ('');  # start out in %::
 
60
  my $this;
 
61
  my $count = 0;
 
62
  my $pref;
 
63
  while(@stack) {
 
64
    $this = shift @stack;
 
65
    die "Too many packages?" if ++$count > 1000;
 
66
    next if exists $v{$this};
 
67
    next if $this eq 'main'; # %main:: is %::
 
68
 
 
69
    #print "Peeking at $this => ${$this . '::VERSION'}\n";
 
70
    no strict 'refs';
 
71
    if( defined ${$this . '::VERSION'} ) {
 
72
      $v{$this} = ${$this . '::VERSION'}
 
73
    } elsif(
 
74
       defined *{$this . '::ISA'} or defined &{$this . '::import'}
 
75
       or ($this ne '' and grep defined *{$_}{'CODE'}, values %{$this . "::"})
 
76
       # If it has an ISA, an import, or any subs...
 
77
    ) {
 
78
      # It's a class/module with no version.
 
79
      $v{$this} = undef;
 
80
    } else {
 
81
      # It's probably an unpopulated package.
 
82
      ## $v{$this} = '...';
 
83
    }
 
84
    
 
85
    $pref = length($this) ? "$this\::" : '';
 
86
    push @stack, map m/^(.+)::$/ ? "$pref$1" : (),
 
87
        do { no strict 'refs'; keys %{$this . '::'} };
 
88
    #print "Stack: @stack\n";
 
89
  }
 
90
  push @out, " Modules in memory:\n";
 
91
  delete @v{'', '[none]'};
 
92
  foreach my $p (sort {lc($a) cmp lc($b)} keys %v) {
 
93
    my $indent = ' ' x (2 + ($p =~ tr/:/:/));
 
94
    push @out,  '  ', $indent, $p, defined($v{$p}) ? " v$v{$p};\n" : ";\n";
 
95
  }
 
96
  push @out, sprintf "[at %s (local) / %s (GMT)]\n",
 
97
    scalar(gmtime), scalar(localtime);
 
98
  my $x = join '', @out;
 
99
  $x =~ s/^/#/mg;
 
100
  print $x;
 
101
}
 
102
 
 
103
print "# Running",
 
104
  (chr(65) eq 'A') ? " in an ASCII world.\n" : " in a non-ASCII world.\n",
 
105
  "#\n",
 
106
;
 
107
 
 
108
print "# \@INC:\n", map("#   [$_]\n", @INC), "#\n#\n";
 
109
 
 
110
print "# \%INC:\n";
 
111
foreach my $x (sort {lc($a) cmp lc($b)} keys %INC) {
 
112
  print "#   [$x] = [", $INC{$x} || '', "]\n";
 
113
}
 
114
 
 
115
ok 1;
 
116