table of contents
Git::Raw::Filter(3pm) | User Contributed Perl Documentation | Git::Raw::Filter(3pm) |
NAME¶
Git::Raw::Filter - Git filter class
VERSION¶
version 0.90
DESCRIPTION¶
A Git::Raw::Filter represents a Git filter.
WARNING: The API of this module is unstable and may change without warning (any change will be appropriately documented in the changelog).
METHODS¶
create( $name, $attributes )¶
Create a filter. $name is a name by which the filter can be referenced. $attributes is a whitespace-separated list of attribute names to check for this filter (e.g. "eol crlf text"). If the attribute name is bare, it will simply be loaded and passed to the "check" callback. If it has a value (i.e. "name=value"), the attribute must match that value for the filter to be applied.
callbacks( \%callbacks )¶
Set the callbacks for the filter. %callbacks may specify the following callbacks.
- "initialize"
Optional callback to be invoked before a filter is first used. It will be called once at most.
- "shutdown"
Optional callback to be invoked when the filter is unregistered or when the library is shutting down. It will be called once at most. This may be called even if "initialize" has never been called.
- "check"
Optional callback that checks if filtering is needed for a given source. The callback receives the following parameters: The filter source, a Git::Raw::Filter::Source object.
If the filter should be applied, "Git::Raw::Error->OK" should be returned. If the filter should be skipped, "Git::Raw::Error->PASSTHROUGH" should be returned.
- "apply"
Callback that actually filters data.
The callback receives the following parameters: The filter source, a Git::Raw::Filter::Source object, $from the source data and $to, a scalar reference where the output should be written to.
If the filter successfully writes the output, "Git::Raw::Error->OK" should be returned. If the filter failed, "Git::Raw::Error->ERROR" should be returned. If the filter does not want to run, "Git::Raw::Error->PASSTHROUGH" should be returned.
- "cleanup"
Optional callback to clean up after filtering has been applied.
register( $priority )¶
Register the filter with priority $priority.
unregister( )¶
Remove the filter.
AUTHOR¶
Alessandro Ghedini <alexbio@cpan.org>
Jacques Germishuys <jacquesg@cpan.org>
LICENSE AND COPYRIGHT¶
Copyright 2014 Alessandro Ghedini.
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.
2024-10-14 | perl v5.40.0 |