| 1 | package Apache::RegistryLexInfo; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use Apache::RegistryNG (); | ||
| 5 | use B::LexInfo (); | ||
| 6 | |||
| 7 | { | ||
| 8 | no strict; | ||
| 9 | @ISA = qw(Apache::RegistryNG); | ||
| 10 | } | ||
| 11 | |||
| 12 | sub is_html { shift->content_type eq "text/html" } | ||
| 13 | |||
| 14 | #RegistryNG uses filename, might be loooong | ||
| 15 | sub namespace_from { shift->uri } | ||
| 16 | |||
| 17 | sub run { | ||
| 18 | my $pr = shift; | ||
| 19 | my $package = $pr->namespace; | ||
| 20 | |||
| 21 | my $lexi = B::LexInfo->new; | ||
| 22 | my $before = $lexi->stash_cvlexinfo($package); | ||
| 23 | $pr->SUPER::run(@_); | ||
| 24 | my $after = $lexi->stash_cvlexinfo($package); | ||
| 25 | my $diff = $lexi->diff($before, $after); | ||
| 26 | |||
| 27 | my $is_html = $pr->is_html; | ||
| 28 | my $hr = $is_html ? "<hr>" : "-=" x 50; | ||
| 29 | my $nl = $is_html ? "<br>\n" : "\n"; | ||
| 30 | print "<pre>\n" if $is_html; | ||
| 31 | print "$hr\n"; | ||
| 32 | print "Diff:$nl", $$diff, "$hr\n"; | ||
| 33 | print "Before:$nl", ${ $lexi->dumper($before) }, "$hr\n"; | ||
| 34 | print "After:$nl", ${ $lexi->dumper($after) }, "$hr\n"; | ||
| 35 | } | ||
| 36 | |||
| 37 | 1; | ||
| 38 | __END__ |