
Zhris
Enthusiast
Jul 9, 2014, 5:37 PM
Post #4 of 6
(186302 views)
|
Re: [BillKSmith] [perl] doesn't work
[In reply to]
|
Can't Post
|
|
Agreed. 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.
#!/usr/bin/perl use strict; use warnings; use Syntax::Highlight::Perl; ##### my $code = <<'CODE'; my $var = 1; print $var; CODE 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 ); Output: 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... Chris
(This post was edited by Zhris on Jul 9, 2014, 5:41 PM)
|