The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Minecraft::SectionFilter - Strip/Process magical § characters from minecraft

VERSION

version 0.003003

SYNOPSIS

    use Minecraft::SectionFilter;
    while(<$some_stream_of_text>){
        if( $ENV{MODE} eq 'STRIP' ) {
            print(strip_sections($_))
        }
        else {
            print(ansi_encode_sections($_));
        }
    }

FUNCTIONS

translate_sections

Parse a string into a series of elements;

    my (@list) = translate_sections($string)

Resulting list will be a list of hashrefs, either:

    { type => text , content => "the string itself" }

or

    { type => section, section_code => $char }

strip_sections

Strip section codes from a string.

    my $output = strip_sections( $input );

ansi_encode_sections

Translate section codes to Term::ANSIColor color codes.

    STDOUT->print( ansi_encode_sections( $minecraft_string ) );

SEE ALSO

Minecraft::RCON which has a similar feature, except its not user-acessible/reusable.

AUTHOR

Kent Fredric <kentnl@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Kent Fredric <kentfredric@gmail.com>.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.