3 # Time-stamp: "2004-04-09 18:02:36 ADT"
5 # Summary of, well, things.
8 BEGIN {plan tests => 2};
20 defined($^V) ? sprintf('%vd', $^V) : $],
22 (defined(&Win32::BuildNumber) and defined &Win32::BuildNumber())
23 ? ("(Win32::BuildNumber ", &Win32::BuildNumber(), ")") : (),
24 (defined $MacPerl::Version)
25 ? ("(MacPerl version $MacPerl::Version)") : (),
29 # Ugly code to walk the symbol tables:
31 my @stack = (''); # start out in %::
37 die "Too many packages?" if ++$count > 1000;
38 next if exists $v{$this};
39 next if $this eq 'main'; # %main:: is %::
41 #print "Peeking at $this => ${$this . '::VERSION'}\n";
43 if(defined ${$this . '::VERSION'} ) {
44 $v{$this} = ${$this . '::VERSION'}
46 defined *{$this . '::ISA'} or defined &{$this . '::import'}
47 or ($this ne '' and grep defined *{$_}{'CODE'}, values %{$this . "::"})
48 # If it has an ISA, an import, or any subs...
50 # It's a class/module with no version.
53 # It's probably an unpopulated package.
57 $pref = length($this) ? "$this\::" : '';
58 push @stack, map m/^(.+)::$/ ? "$pref$1" : (), keys %{$this . '::'};
59 #print "Stack: @stack\n";
61 push @out, " Modules in memory:\n";
62 delete @v{'', '[none]'};
63 foreach my $p (sort {lc($a) cmp lc($b)} keys %v) {
64 $indent = ' ' x (2 + ($p =~ tr/:/:/));
65 push @out, ' ', $indent, $p, defined($v{$p}) ? " v$v{$p};\n" : ";\n";
67 push @out, sprintf "[at %s (local) / %s (GMT)]\n",
68 scalar(gmtime), scalar(localtime);
69 my $x = join '', @out;
75 (chr(65) eq 'A') ? " in an ASCII world.\n" : " in a non-ASCII world.\n",
79 print "# \@INC:\n", map("# [$_]\n", @INC), "#\n#\n";
82 foreach my $x (sort {lc($a) cmp lc($b)} keys %INC) {
83 print "# [$x] = [", $INC{$x} || '', "]\n";