<%doc> Usage: <& view_source.html &> When called, will display the highlighted source of the calling component. required: none % unless (defined $caller) { View Source % } <%init> if (defined $caller) { my $comp = $m->fetch_comp($caller); my $file = $comp->source_file($comp); local $/ = undef; open(my $io,$file) or die "$! at $file"; my $source = <$io>; close($io); my $compiler = Syntax::Highlight::Mason->new(); $m->print($compiler->compile($source)); } <%args> $caller => undef <%once> use Syntax::Highlight::Mason;