The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Filter::Undent - Un-indent heredoc strings automatically

VERSION

Version 1.0

SYNOPSIS

Don't you wish heredocs could align with your docs? Now they can!

        use Filter::Undent;
        print <<'EOF'
                What is printed is magically undented to the level of the
                first line of the heredoc.

                        Only these lines will be indented in the output, since they
                        are indented relative to the first line
        EOF

If you want to disable the unindent of the heredocs, simply:

        no Filter::Undent;

FUNCTIONS

undent "string to un-indent"

This function does the actual work of unindenting. It takes in a string, ignores any leading newlines, and if the first line of the provided string is indented with space or tab characters, it will remove the same whitespace from the beginning of all of the subsequent lines. Any lines which are outdented from the first line, or is using a different combination of spaces or tabs, will not have its leading space removed.

AUTHOR

Anthony Kilna, <kilna at kilna.com>

BUGS

Please report any bugs or feature requests to bug-filter-undent at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Filter-Undent. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Filter::Undent

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2012 Anthony Kilna.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.