7 # Time-stamp: "2004-12-29 20:57:15 AST"
8 # Summary of, well, things.
11 BEGIN {plan tests => 2};
22 defined($^V) ? sprintf('%vd', $^V) : $],
24 (defined(&Win32::BuildNumber) and defined &Win32::BuildNumber())
25 ? ("(Win32::BuildNumber ", &Win32::BuildNumber(), ")") : (),
26 (defined $MacPerl::Version)
27 ? ("(MacPerl version $MacPerl::Version)") : (),
31 # Ugly code to walk the symbol tables:
33 my @stack = (''); # start out in %::
39 die "Too many packages?" if ++$count > 1000;
40 next if exists $v{$this};
41 next if $this eq 'main'; # %main:: is %::
43 #print "Peeking at $this => ${$this . '::VERSION'}\n";
45 if(defined ${$this . '::VERSION'} ) {
46 $v{$this} = ${$this . '::VERSION'}
48 defined *{$this . '::ISA'} or defined &{$this . '::import'}
49 or ($this ne '' and grep defined *{$_}{'CODE'}, values %{$this . "::"})
50 # If it has an ISA, an import, or any subs...
52 # It's a class/module with no version.
55 # It's probably an unpopulated package.
59 $pref = length($this) ? "$this\::" : '';
60 push @stack, map m/^(.+)::$/ ? "$pref$1" : (), keys %{$this . '::'};
61 #print "Stack: @stack\n";
63 push @out, " Modules in memory:\n";
64 delete @v{'', '[none]'};
65 foreach my $p (sort {lc($a) cmp lc($b)} keys %v) {
66 $indent = ' ' x (2 + ($p =~ tr/:/:/));
67 push @out, ' ', $indent, $p, defined($v{$p}) ? " v$v{$p};\n" : ";\n";
69 push @out, sprintf "[at %s (local) / %s (GMT)]\n",
70 scalar(gmtime), scalar(localtime);
71 my $x = join '', @out;
77 (chr(65) eq 'A') ? " in an ASCII world.\n" : " in a non-ASCII world.\n",
81 print "# \@INC:\n", map("# [$_]\n", @INC), "#\n#\n";
84 foreach my $x (sort {lc($a) cmp lc($b)} keys %INC) {
85 print "# [$x] = [", $INC{$x} || '', "]\n";