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