Git::Raw::Filter(3pm)

πŸ’– Git::Raw::Filter β€” the manual, but make it cute

okay so bestie, this is the Git::Raw::Filter page from the User Contributed Perl Documentation set, and I'm gonna walk you through it like we're texting at 1am. it's a whole vibe. let's go πŸ¦‹


✨ VERSION ✨

version 0.90

yeah. that's the one. no cap. πŸ‘‘


🌸 DESCRIPTION 🌸

so a Git::Raw::Filter represents a Git filter. that's it, that's the whole personality. it's the little object that gets to peek at your data and go "hmm, do i need to touch this?" πŸ’…

⚠️ WARNING: the API of this module is unstable and may change without warning (any change will be appropriately documented in the changelog). so like… do not build your entire life on this. the vibe is subject to change, fr fr. 😭

⭐ METHODS ⭐


πŸŽ€ create( $name, $attributes )

creates a filter. iconique behaviour.

  • $name is a name by which the filter can be referenced. (its government name, basically)
  • $attributes is a whitespace-separated list of attribute names to check for this filter (e.g. "eol crlf text").

now the ✨tea✨ on attributes:

  • if the attribute name is bare, it will simply be loaded and passed to the "check" callback. simple. lowkey.
  • if it has a value (i.e. "name=value"), the attribute must match that value for the filter to be applied. no match, no filter, sorry bestie 🫢

πŸ¦‹ callbacks( \%callbacks )

sets the callbacks for the filter. %callbacks may specify the following callbacks β€” and yes, we're going through every single one, i don't skip. πŸ’–

  • "initialize" β€” optional callback to be invoked before a filter is first used. it will be called once at most. a one-time appearance, main character energy only for a moment. ✨
  • "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. heads up though: this may be called even if "initialize" has never been called. rude? maybe. true? absolutely. 😭
  • "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.

so like, if the filter should be applied, return Git::Raw::Error->OK. if the filter should be skipped, return Git::Raw::Error->PASSTHROUGH. that's the whole decision tree, you got this πŸ’…

  • "apply" β€” the callback that actually filters data. this is the one doing the real work, the one carrying the team πŸ‹οΈ

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.

and the return value gossip:

  • if the filter successfully writes the output, return Git::Raw::Error->OK βœ…
  • if the filter failed, return Git::Raw::Error->ERROR πŸ’€
  • if the filter does not want to run, return Git::Raw::Error->PASSTHROUGH πŸ™ˆ
  • "cleanup" β€” optional callback to clean up after filtering has been applied. the lil tidy-up moment. so satisfying. 🧚

🌈 register( $priority )

register the filter with priority $priority. put it in the lineup, give it a number, let it know its place. slay.


πŸ’œ unregister( )

remove the filter. that's it. it's leaving the group chat. πŸ‘‹


πŸ‘‘ AUTHOR πŸ‘‘

  • Alessandro Ghedini <alexbio@cpan.org>
  • Jacques Germishuys <jacquesg@cpan.org>

the legends themselves. we stan. 🫢


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.


and that's the whole page bestie!! ✨ this was perl v5.42.3, dated 2026-08-19, straight from Git::Raw::Filter(3pm) β€” go forth and filter, you absolute icon πŸŽ€πŸ’–

πŸ“¦ where this page comes from