9 # Time-stamp: "2004-04-27 19:44:49 ADT"
11 # Summary of, well, things.
14 BEGIN {plan tests => 2};
26 defined($^V) ? sprintf('%vd', $^V) : $],
28 (defined(&Win32::BuildNumber) and defined &Win32::BuildNumber())
29 ? ("(Win32::BuildNumber ", &Win32::BuildNumber(), ")") : (),
30 (defined $MacPerl::Version)
31 ? ("(MacPerl version $MacPerl::Version)") : (),
35 # Ugly code to walk the symbol tables:
37 my @stack = (''); # start out in %::
43 die "Too many packages?" if ++$count > 1000;
44 next if exists $v{$this};
45 next if $this eq 'main'; # %main:: is %::
47 #print "Peeking at $this => ${$this . '::VERSION'}\n";
49 if(defined ${$this . '::VERSION'} ) {
50 $v{$this} = ${$this . '::VERSION'}
52 defined *{$this . '::ISA'} or defined &{$this . '::import'}
53 or ($this ne '' and grep defined *{$_}{'CODE'}, values %{$this . "::"})
54 # If it has an ISA, an import, or any subs...
56 # It's a class/module with no version.
59 # It's probably an unpopulated package.
63 $pref = length($this) ? "$this\::" : '';
64 push @stack, map m/^(.+)::$/ ? "$pref$1" : (), keys %{$this . '::'};
65 #print "Stack: @stack\n";
67 push @out, " Modules in memory:\n";
68 delete @v{'', '[none]'};
69 foreach my $p (sort {lc($a) cmp lc($b)} keys %v) {
70 $indent = ' ' x (2 + ($p =~ tr/:/:/));
71 push @out, ' ', $indent, $p, defined($v{$p}) ? " v$v{$p};\n" : ";\n";
73 push @out, sprintf "[at %s (local) / %s (GMT)]\n",
74 scalar(gmtime), scalar(localtime);
75 my $x = join '', @out;
81 (chr(65) eq 'A') ? " in an ASCII world.\n" : " in a non-ASCII world.\n",
85 print "# \@INC:\n", map("# [$_]\n", @INC), "#\n#\n";
88 foreach my $x (sort {lc($a) cmp lc($b)} keys %INC) {
89 print "# [$x] = [", $INC{$x} || '', "]\n";