| 1 | package Term::ANSIColor::Markup; | ||
| 2 | 4 | ▶ | use 5.008_001; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 4 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 4 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 4 | ▶ | use Term::ANSIColor::Markup::Parser; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 4 | ▶ | use base qw(Class::Accessor::Lvalue::Fast); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 4 | our $VERSION = '0.06'; | |
| 9 | |||
| 10 | 4 | __PACKAGE__->mk_accessors(qw(parser text)); | |
| 11 | |||
| 12 | 9 | ▶ | sub new { |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||
| 13 | 9 | my $class = shift; | |
| 14 | 9 | bless { | |
| 15 | parser => Term::ANSIColor::Markup::Parser->new, | ||
| 16 | text => '', | ||
| 17 | }, $class; | ||
| 18 | } | ||
| 19 | |||
| 20 | 9 | ▶ | sub parse { |
|
Subroutine
parse: called CC=1 SCAR=0.0
Pod
documented
| |||
| 21 | 9 | my ($self, $text) = @_; | |
| 22 | 9 | $self->parser->parse($text); | |
| 23 | 8 | $self->parser->eof; | |
| 24 | 8 | $self->text = $self->parser->text; | |
| 25 | } | ||
| 26 | |||
| 27 | 5 | ▶ | sub colorize { |
|
Subroutine
colorize: called CC=1 SCAR=0.0
Pod
documented
| |||
| 28 | 5 | my ($class, $text) = @_; | |
| 29 | 5 | my $self = $class->new; | |
| 30 | 5 | $self->parse($text); | |
| 31 | 4 | $self->text; | |
| 32 | } | ||
| 33 | |||
| 34 | 4 | 1; | |
| 35 | |||
| 36 | __END__ | ||