Jul 9, 2014, 5:37 PM
Post #4 of 6
Re: [BillKSmith] [perl] doesn't work
[In reply to]
It would be kind of a cool feature though. I have been playing with Syntax::Highlight::Perl this evening, influenced by this post, but the highlighter no longer exists. Perhaps this is something that could be worked on and hosted someplace.
my $code = <<'CODE';
my $var = 1;
my $colours =
Variable => 'red'
my $formatter = Syntax::Highlight::Perl->new( );
while ( my ( $type, $colour ) = each ( %$colours ) )
$formatter->set_start_format( $type, "[$colour]" );
$formatter->set_end_format( $type, "[/$colour]" );
print $formatter->format_string( $code );
Could even go as far as for example, pulling out regular expressions and listing their YAPE::Regex::Explain plans underneath in separate code blocks, or tidying up code via Perl::Tidy etc...
(This post was edited by Zhris on Jul 9, 2014, 5:41 PM)