=pod

=for comment
DO NOT EDIT. This Pod was generated by Swim.
See http://github.com/ingydotnet/swim-pm#readme

=encoding utf8

=head1 NAME

Test::Base::Filter - Default Filter Class for Test::Base

=head1 SYNOPSIS

      package MyTestSuite;
      use Test::Base -Base;

      ... reusable testing code ...

      package MyTestSuite::Filter;
      use Test::Base::Filter -Base;

      sub my_filter1 {
          ...
      }

=head1 DESCRIPTION

Filters are the key to writing effective data driven tests with Test::Base.
Test::Base::Filter is a class containing a large default set of generic
filters. You can easily subclass it to add/override functionality.

=head1 FILTERS

This is a list of the default stock filters (in alphabetic order):

=over

=item C<append>

list => list

Append a string to each element of a list.

    --- numbers lines chomp append=-#\n join
    one
    two
    three

=item C<array>

list => scalar

Turn a list of values into an anonymous array reference.

=item C<base64_decode>

scalar => scalar

Decode base64 data. Useful for binary tests.

=item C<base64_encode>

scalar => scalar

Encode base64 data. Useful for binary tests.

=item C<chomp>

list => list

Remove the final newline from each string value in a list.

=item C<chop>


=back

list => list

    Remove the final char from each string value in a list.

=over

=item C<dumper>

scalar => list

Take a data structure (presumably from another filter like eval) and use
Data::Dumper to dump it in a canonical fashion.

=item C<escape>

scalar => scalar

Unescape all backslash escaped chars.

=item C<eval>

scalar => list

Run Perl's C<eval> command against the data and use the returned value
as the data.

=item C<eval_all>

scalar => list

Run Perl's C<eval> command against the data and return a list of 4 values:

    1) The return value
    2) The error in $@
    3) Captured STDOUT
    4) Captured STDERR

=item C<eval_stderr>

scalar => scalar

Run Perl's C<eval> command against the data and return the captured STDERR.

=item C<eval_stdout>

scalar => scalar

Run Perl's C<eval> command against the data and return the captured STDOUT.

=item C<exec_perl_stdout>

list => scalar

Input Perl code is written to a temp file and run. STDOUT is captured
and returned.

=item C<flatten>

scalar => list

Takes a hash or array ref and flattens it to a list.

=item C<get_url>

scalar => scalar

The text is chomped and considered to be a url. Then LWP::Simple::get is used
to fetch the contents of the url.

=item C<hash>

list => scalar

Turn a list of key/value pairs into an anonymous hash reference.

=item C<head[=number]>

list => list

Takes a list and returns a number of the elements from the front of it. The
default number is one.

=item C<join>

list => scalar

Join a list of strings into a scalar.

=item C<Join>

Join the list of strings inside a list of array refs and return the strings in
place of the array refs.

=item C<lines>

scalar => list

Break the data into an anonymous array of lines. Each line (except
possibly the last one if the C<chomp> filter came first) will have a
newline at the end.

=item C<norm>

scalar => scalar

Normalize the data. Change non-Unix line endings to Unix line endings.

=item C<prepend=string>

list => list

Prepend a string onto each of a list of strings.

=item C<read_file>

scalar => scalar

Read the file named by the current content and return the file's content.

=item C<regexp[=xism]>

scalar => scalar

The C<regexp> filter will turn your data section into a regular expression
object. You can pass in extra flags after an equals sign.

If the text contains more than one line and no flags are specified, then the
'xism' flags are assumed.

=item C<reverse>

list => list

Reverse the elements of a list.

=item C<Reverse>

list => list

Reverse the list of strings inside a list of array refs.

=item C<slice=x[,y]>

list => list

Returns the element number x through element number y of a list.

=item C<sort>

list => list

Sorts the elements of a list in character sort order.

=item C<Sort>

list => list

Sort the list of strings inside a list of array refs.

=item C<split[=string|pattern]>

scalar => list

Split a string in into a list. Takes a optional string or regexp as a
parameter. Defaults to I<s+>. Same as Perl C<split>.

=item C<Split[=string|pattern]>

list => list

Split each of a list of strings and turn them into array refs.

=item C<strict>

scalar => scalar

Prepend the string:

    use strict;
    use warnings;

to the block's text.

=item C<tail[=number]>

list => list

Return a number of elements from the end of a list. The default number is one.

=item C<trim>

list => list

Remove extra blank lines from the beginning and end of the data. This allows
you to visually separate your test data with blank lines.

=item C<unchomp>

list => list

Add a newline to each string value in a list.

=item C<write_file[=filename]>

scalar => scalar

Write the content of the section to the named file. Return the filename.

=item C<yaml>

scalar => list

Apply the YAML::Load function to the data block and use the resultant
structure. Requires YAML.pm.

=back

=head1 AUTHOR

Ingy döt Net <ingy@cpan.org>

=head1 COPYRIGHT

Copyright 2005-2014. Ingy döt Net. All rights reserved.

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

See L<http://www.perl.com/perl/misc/Artistic.html>

=cut
