View on
MetaCPAN
search.cpan.org is shutting down
For details read Perl NOC. After June 25th this page will redirect to MetaCPAN.org
Erik Carlsson > String-Cushion-0.0200 > String::Cushion

Download:
String-Cushion-0.0200.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.0200   Source  

NAME ^

String::Cushion - Vertically pad a string

VERSION ^

Version 0.0200, released 2017-05-18.

SYNOPSIS ^

    use String::Cushion;


    sub out {
        print cushion 2, 3, q{
            A short
            text
        };
    }

    # is exactly the same as
    sub out {
        print q{

            A short
            text.


        };
    }

DESCRIPTION ^

String::Cushion provides cushion, a simple function that removes all leading and trailing lines and lines only consisting of white space or line breaks, and then adds a specified number of leading and trailing new lines (\n).

METHODS

cushion $number_of_new_lines, $string

    # "\n        hello\n"
    my $string = cushion 1, q{
        hello
    };

cushion $number_of_leading_new_lines, $number_of_trailing_new_lines, $string

    # "\n        hello\n\n"
    my $string = cushion 1, 2, q{
        hello
    };

SEE ALSO ^

SOURCE ^

https://github.com/Csson/p5-String-Cushion

HOMEPAGE ^

https://metacpan.org/release/String-Cushion

AUTHOR ^

Erik Carlsson <info@code301.com>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2016 by Erik Carlsson.

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

syntax highlighting: