Add 5.11.3 to perlhist.
[p5sagit/p5-mst-13.2.git] / dist / Pod-Perldoc / t / 01_about_verbose.t
CommitLineData
19006a1d 1
2require 5;
3# Time-stamp: "2004-04-09 18:02:36 ADT"
4
5# Summary of, well, things.
6
08332554 7use Test::More tests => 2;
19006a1d 8
08332554 9BEGIN {
10 use_ok 'Pod::Perldoc';
11}
19006a1d 12
13#chdir "t" if -e "t";
14
15{
16 my @out;
17 push @out,
18 "\n\nPerl v",
19 defined($^V) ? sprintf('%vd', $^V) : $],
20 " under $^O ",
21 (defined(&Win32::BuildNumber) and defined &Win32::BuildNumber())
22 ? ("(Win32::BuildNumber ", &Win32::BuildNumber(), ")") : (),
23 (defined $MacPerl::Version)
24 ? ("(MacPerl version $MacPerl::Version)") : (),
25 "\n"
26 ;
27
28 # Ugly code to walk the symbol tables:
29 my %v;
30 my @stack = (''); # start out in %::
31 my $this;
32 my $count = 0;
33 my $pref;
34 while(@stack) {
35 $this = shift @stack;
36 die "Too many packages?" if ++$count > 1000;
37 next if exists $v{$this};
38 next if $this eq 'main'; # %main:: is %::
39
40 #print "Peeking at $this => ${$this . '::VERSION'}\n";
41
42 if(defined ${$this . '::VERSION'} ) {
43 $v{$this} = ${$this . '::VERSION'}
44 } elsif(
45 defined *{$this . '::ISA'} or defined &{$this . '::import'}
46 or ($this ne '' and grep defined *{$_}{'CODE'}, values %{$this . "::"})
47 # If it has an ISA, an import, or any subs...
48 ) {
49 # It's a class/module with no version.
50 $v{$this} = undef;
51 } else {
52 # It's probably an unpopulated package.
53 ## $v{$this} = '...';
54 }
55
56 $pref = length($this) ? "$this\::" : '';
57 push @stack, map m/^(.+)::$/ ? "$pref$1" : (), keys %{$this . '::'};
58 #print "Stack: @stack\n";
59 }
60 push @out, " Modules in memory:\n";
61 delete @v{'', '[none]'};
62 foreach my $p (sort {lc($a) cmp lc($b)} keys %v) {
63 $indent = ' ' x (2 + ($p =~ tr/:/:/));
64 push @out, ' ', $indent, $p, defined($v{$p}) ? " v$v{$p};\n" : ";\n";
65 }
66 push @out, sprintf "[at %s (local) / %s (GMT)]\n",
67 scalar(gmtime), scalar(localtime);
68 my $x = join '', @out;
69 $x =~ s/^/#/mg;
70 print $x;
71}
72
73print "# Running",
74 (chr(65) eq 'A') ? " in an ASCII world.\n" : " in a non-ASCII world.\n",
75 "#\n",
76;
77
78print "# \@INC:\n", map("# [$_]\n", @INC), "#\n#\n";
79
80print "# \%INC:\n";
81foreach my $x (sort {lc($a) cmp lc($b)} keys %INC) {
82 print "# [$x] = [", $INC{$x} || '', "]\n";
83}
84
08332554 85pass();
19006a1d 86