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