++ed by:
ABRAXXA

1 PAUSE user

Trevor Cornpropst
and 1 contributors

NAME

Str::Filter - Garbage in, goodness out

VERSION

This documentation refers to Str::Filter version 0.01.

SYNOPSIS

    use Str::Filter qw(:ALL);

    sub filtration {
        filter_leading_whitespace( $_[0] );
        filter_trailing_whitespace( $_[0] );
        filter_collapse_whitespace( $_[0] );
    }

    filtration($input);

    # cleansed, no more whitespace
    print "input\n";

DESCRIPTION

Str::Filter is a collection of common routines for processing mainly input data but also works to filter outbound data. These filters are intended to be called in high volume environments so, there is not a lot of handing data back and forth. These subs work on the actual value passed so, beware, your data WILL be transformed.

SUBROUTINES/METHODS

filter_leading_whitespace()

Removes leading whitespace.

filter_trailing_whitespace()

Removes trailing whitespace.

filter_collapse_whitespace()

Collapses multiple contiguous whitespace to one.

filter_control_characters()

Removes nasty control characters.

filter_ascii_only()

Ensures you only have ascii characters in your string.

filter_escape_pipes()

Escape pipes, to preserve pipe delimted strings in certain parsing situations.

filter_end_brackets()

This is useful in XML environments where you want to output data in an XML CDATA container. In order for that to work, you must filter out ]] from the data or the XML processor won't know where your CDATA ends.

filter_html()

Strips ALL HTML from the input.

Filters style tags.

filter_style_tags()

Filters ALL style tags from text.

EXAMPLES

Combine a bunch of filters into one operation.

    sub filtrate {
        filter_leading_whitespace($_[0]);
        filter_trailing_whitespace($_[0]);
        filter_collapse_whitespace($_[0]);
        filter_control_characters($_[0]);
        filter_ascii_only($_[0]);
        filter_end_brackets($_[0]);
    }

    # and then...

    filtrate($my_data);

DIAGNOSTICS

None.

CONFIGURATION AND ENVIRONMENT

Str::Filter requires no configuration files or environment variables.

DEPENDENCIES

  • HTML::Strip

  • Exporter

INCOMPATIBILITIES

None reported.

BUGS AND LIMITATIONS

No bugs have been reported.

Please report any issues or feature requests to https://github.com/tscornpropst/Str-Filter/issues. Patches are welcome.

AUTHOR

Trevor S. Cornpropst <tscornpropst@gmail.com>

COPYRIGHT AND LICENSE

Copyright (c) 2005 - 2014, Trevor Cornpropst <tscornpropst@gmail.com>. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:

http://www.perlfoundation.org/artistic_license_2_0

Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.