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

NAME

Text::Parser::Multiline - To be used to add custom line-unwrapping routines to the Text::Parser object.

VERSION

version 1.000

SYNOPSIS

Input text file:

    This is a line that is wrapped with a trailing percent sign %
    like the last one. This may seem unusual, but hey, it's an %
    example.

The code required to unwrap this:

    use Text::Parser;

    my $parser = Text::Parser->new(multiline_type => 'join_next');
    $parser->custom_line_unwrap_routines(
        is_wrapped => sub {  # A method to detect if this line is wrapped
            my ($self, $this_line) = @_;
            $this_line =~ /\%\s*$/;
        }, 
        unwrap_routine => sub { # Method to unwrap line, gets called only on line after % sign
            my ($self, $last_line, $this_line) = @_;
            chomp $last_line;
            $last_line =~ s/\%\s*$//g;
            "$last_line $this_line";
        }, 
    );

When $parser gets to read the input text, those three lines get unwrapped and processed by the rules as if it were a single line.

DESCRIPTION

You should not use this module directly in your code. The functionality of this role is accessed through Text::Parser. The purpose of this role is to write custom routines to unwrap line-wrapped text input, using an object of Text::Parser.

SEE ALSO

BUGS

Please report any bugs or feature requests on the bugtracker website http://github.com/balajirama/Text-Parser/issues

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHOR

Balaji Ramasubramanian <balajiram@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2018-2019 by Balaji Ramasubramanian.

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