2 # Time-stamp: "2004-04-24 16:53:03 ADT"
4 # Summary of, well, things.
7 BEGIN {plan tests => 2};
15 defined($^V) ? sprintf('%vd', $^V) : $],
17 (defined(&Win32::BuildNumber) and defined &Win32::BuildNumber())
18 ? ("(Win32::BuildNumber ", &Win32::BuildNumber(), ")") : (),
19 (defined $MacPerl::Version)
20 ? ("(MacPerl version $MacPerl::Version)") : (),
24 # Ugly code to walk the symbol tables:
26 my @stack = (''); # start out in %::
32 die "Too many packages?" if ++$count > 1000;
33 next if exists $v{$this};
34 next if $this eq 'main'; # %main:: is %::
36 #print "Peeking at $this => ${$this . '::VERSION'}\n";
38 if(defined ${$this . '::VERSION'} ) {
39 $v{$this} = ${$this . '::VERSION'}
41 defined *{$this . '::ISA'} or defined &{$this . '::import'}
42 or ($this ne '' and grep defined *{$_}{'CODE'}, values %{$this . "::"})
43 # If it has an ISA, an import, or any subs...
45 # It's a class/module with no version.
48 # It's probably an unpopulated package.
52 $pref = length($this) ? "$this\::" : '';
53 push @stack, map m/^(.+)::$/ ? "$pref$1" : (), keys %{$this . '::'};
54 #print "Stack: @stack\n";
56 push @out, " Modules in memory:\n";
57 delete @v{'', '[none]'};
58 foreach my $p (sort {lc($a) cmp lc($b)} keys %v) {
59 $indent = ' ' x (2 + ($p =~ tr/:/:/));
60 push @out, ' ', $indent, $p, defined($v{$p}) ? " v$v{$p};\n" : ";\n";
62 push @out, sprintf "[at %s (local) / %s (GMT)]\n",
63 scalar(gmtime), scalar(localtime);
64 my $x = join '', @out;
70 (chr(65) eq 'A') ? " in an ASCII world.\n" : " in a non-ASCII world.\n",
74 print "# \@INC:\n", map("# [$_]\n", @INC), "#\n#\n";
77 foreach my $x (sort {lc($a) cmp lc($b)} keys %INC) {
78 print "# [$x] = [", $INC{$x} || '', "]\n";