blib/lib/Git/Raw/Filter.pm

filter: Statementstmt 100% 11 / 11 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 100% 14 / 14 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/Git/Raw/Diff/Stats.pm ↑ Summary blib/lib/Git/Raw/Filter/List.pm »
1 package Git::Raw::Filter;
2 1 $Git::Raw::Filter::VERSION = '0.90';
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use Git::Raw;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 =head1 NAME
9  
10 Git::Raw::Filter - Git filter class
11  
12 =head1 VERSION
13  
14 version 0.90
15  
16 =head1 DESCRIPTION
17  
18 A L<Git::Raw::Filter> represents a Git filter.
19  
20 B<WARNING>: The API of this module is unstable and may change without warning
21 (any change will be appropriately documented in the changelog).
22  
23 =head1 METHODS
24  
25 =head2 create( $name, $attributes )
26  
27 Create a filter. C<$name> is a name by which the filter can be referenced.
28 C<$attributes> is a whitespace-separated list of attribute names to check for
29 this filter (e.g. C<"eol crlf text">). If the attribute name is bare, it will
30 simply be loaded and passed to the C<"check"> callback. If it has a value
31 (i.e. "name=value"), the attribute must match that value for the filter to
32 be applied.
33  
34 =head2 callbacks( \%callbacks )
35  
36 Set the callbacks for the filter. C<%callbacks> may specify the following
37 callbacks.
38  
39 =over 4
40  
41 =item * "initialize"
42  
43 Optional callback to be invoked before a filter is first used. It will be
44 called once at most.
45  
46 =item * "shutdown"
47  
48 Optional callback to be invoked when the filter is unregistered or when
49 the library is shutting down. It will be called once at most. This may be
50 called even if C<"initialize"> has never been called.
51  
52 =item * "check"
53  
54 Optional callback that checks if filtering is needed for a given source.
55 The callback receives the following parameters: The filter source, a
56 L<Git::Raw::Filter::Source> object.
57  
58 If the filter should be applied, C<Git::Raw::Error-E<gt>OK> should be returned.
59 If the filter should be skipped, C<Git::Raw::Error-E<gt>PASSTHROUGH> should be
60 returned.
61  
62 =item * "apply"
63  
64 Callback that actually filters data.
65  
66 The callback receives the following parameters: The filter source, a
67 L<Git::Raw::Filter::Source> object, C<$from> the source data and C<$to>,
68 a scalar reference where the output should be written to.
69  
70 If the filter successfully writes the output, C<Git::Raw::Error-E<gt>OK> should
71 be returned. If the filter failed, C<Git::Raw::Error-E<gt>ERROR> should be
72 returned. If the filter does not want to run, C<Git::Raw::Error-E<gt>PASSTHROUGH>
73 should be returned.
74  
75 =item * "cleanup"
76  
77 Optional callback to clean up after filtering has been applied.
78  
79 =back
80  
81 =head2 register( $priority )
82  
83 Register the filter with priority C<$priority>.
84  
85 =head2 unregister( )
86  
87 Remove the filter.
88  
89 =head1 AUTHOR
90  
91 Alessandro Ghedini <alexbio@cpan.org>
92  
93 Jacques Germishuys <jacquesg@cpan.org>
94  
95 =head1 LICENSE AND COPYRIGHT
96  
97 Copyright 2014 Alessandro Ghedini.
98  
99 This program is free software; you can redistribute it and/or modify it
100 under the terms of either: the GNU General Public License as published
101 by the Free Software Foundation; or the Artistic License.
102  
103 See http://dev.perl.org/licenses/ for more information.
104  
105 =cut
106  
107 1 1; # End of Git::Raw::Filter
« blib/lib/Git/Raw/Diff/Stats.pm ↑ Summary blib/lib/Git/Raw/Filter/List.pm »