| … | |
… | |
| 59 | my $refType = ref $ref; |
59 | my $refType = ref $ref; |
| 60 | my $result; |
60 | my $result; |
| 61 | if ($refType and not $dontExpand->{$refType}) { |
61 | if ($refType and not $dontExpand->{$refType}) { |
| 62 | my $baseType = refBaseType($ref); |
62 | my $baseType = refBaseType($ref); |
| 63 | $result .= '<font size="1" color="grey">' . $refType; |
63 | $result .= '<font size="1" color="grey">' . $refType; |
| 64 | $result .= " ($baseType)" if $refType ne $baseType; |
64 | $result .= " ($baseType)" if $baseType and $refType ne $baseType; |
| 65 | $result .= ":</font><br>"; |
65 | $result .= ":</font><br>"; |
| 66 | $result .= '<table border="1" cellpadding="2">'; |
66 | $result .= '<table border="1" cellpadding="2">'; |
| 67 | if ($baseType eq "HASH") { |
67 | if ($baseType eq "HASH") { |
| 68 | my %hash = %$ref; |
68 | my %hash = %$ref; |
| 69 | foreach (sort keys %hash) { |
69 | foreach (sort keys %hash) { |
| … | |
… | |
| 98 | } |
98 | } |
| 99 | |
99 | |
| 100 | sub refBaseType($) { |
100 | sub refBaseType($) { |
| 101 | my $ref = shift; |
101 | my $ref = shift; |
| 102 | local $SIG{__DIE__} = 'IGNORE'; |
102 | local $SIG{__DIE__} = 'IGNORE'; |
| 103 | return "CODE" if eval { $_ = \&$ref; 1 }; |
|
|
| 104 | return "HASH" if eval { $_ = %$ref; 1 }; |
103 | return "HASH" if eval { $_ = %$ref; 1 }; |
| 105 | return "ARRAY" if eval { $_ = @$ref; 1 }; |
104 | return "ARRAY" if eval { $_ = @$ref; 1 }; |
| 106 | return "SCALAR" if eval { $_ = $$ref; 1 }; |
105 | return "SCALAR" if eval { $_ = $$ref; 1 }; |
| 107 | return 0; |
106 | return 0; |
| 108 | } |
107 | } |