1 |
package Frey::INC; |
2 |
use Moose; |
3 |
|
4 |
extends 'Frey'; |
5 |
with 'Frey::Web', 'Frey::Storage'; |
6 |
|
7 |
use Data::Dump qw/dump/; |
8 |
|
9 |
=head1 DESCRIPTION |
10 |
|
11 |
Dump perl's internal C<< %INC >> hash to see which packages are loaded |
12 |
|
13 |
=cut |
14 |
|
15 |
#our $html; |
16 |
|
17 |
sub as_markup { |
18 |
my ( $self ) = @_; |
19 |
|
20 |
# return $html if $html; |
21 |
my $html; |
22 |
|
23 |
my $inc; |
24 |
map { |
25 |
my $class = $_; |
26 |
my $path = $_; |
27 |
$path =~ s{.pm$}{}; |
28 |
$path =~ s[/][}->{]g; |
29 |
$class =~ s[/][::]g; |
30 |
eval '$inc->{' . $path . '} = $class'; ## no critic |
31 |
} sort keys %INC; |
32 |
|
33 |
$html = dump( $inc ); |
34 |
$html =~ s{\s+=>\s+\d+}{}gs; |
35 |
$html =~ s{(['"]?)(\w+)\1\s+=>\s+(['"]?)([\w:]*\2)\3}{<a target="$4" href="/$4" title="$4">$2</a>}gs; |
36 |
$html =~ s{\s+=>\s+}{ }gs; |
37 |
$html =~ s{,}{}gs; |
38 |
|
39 |
$self->store( 'var/INC/' . time() . '.html', $html ); |
40 |
return $html; |
41 |
} |
42 |
|
43 |
__PACKAGE__->meta->make_immutable; |
44 |
no Moose; |
45 |
|
46 |
1; |