PatchReader(3)
πΈ NAME πΈ
PatchReader β Utilities to read and manipulate patches and CVS. hiii bestie, you're on the PatchReader(3) page, and it's literally your cheat sheet for reading and manipulating patches and CVS. iconic behavior. π«Ά
β¨ SYNOPSIS β¨
okay so here's the script flex: it reads in a patch β any known format β and prints out some info about it. other common operations are outputting the patch in a raw unified diff format, outputting the patch information to Template::Toolkit templates, adding context to a patch from CVS, and narrowing the patch down so it only applies to a single file or set of files. no cap. π
# Script that reads in a patch (in any known format), and prints
# out some information about it. Other common operations are
# outputting the patch in a raw unified diff format, outputting
# the patch information to Template::Toolkit templates, adding
# context to a patch from CVS, and narrowing the patch down to
# apply only to a single file or set of files.
use PatchReader::Raw;
use PatchReader::PatchInfoGrabber;
my $filename = 'filename.patch';
# Create the reader that parses the patch and the object that
# extracts info from the reader's datastream
my $reader = new PatchReader::Raw();
my $patch_info_grabber = new PatchReader::PatchInfoGrabber();
$reader->sends_data_to($patch_info_grabber);
# Iterate over the file
$reader->iterate_file($filename);
# Print the output
my $patch_info = $patch_info_grabber->patch_info();
print "Summary of Changed Files:\n";
while (my ($file, $info) = each %{$patch_info->{files}}) {
print "$file: +$info->{plus_lines} -$info->{minus_lines}\n";
}
π¦ ABSTRACT π¦
this perl library is designed so you can manipulate patches programmatically by chaining together a whole little squad of objects that read, manipulate, and output patch information. the lineup is:
PatchReader::Rawβ parses a patch in any format known to this author (unified,normal,cvs diff, among others). slay. π₯PatchReader::PatchInfoGrabberβ grabs summary info for sections of a patch in a nice hash. πPatchReader::AddCVSContextβ adds context to the patch by grabbing the original files from CVS. π§PatchReader::NarrowPatchβ narrows a patch down to only apply to a specific set of files. π¦PatchReader::DiffPrinter::rawβ outputs the parsed patch in raw unified diff format. πPatchReader::DiffPrinter::templateβ outputs the parsed patch toTemplate::Toolkittemplates (can be used to make HTML output or anything else you please). β¨
and the extra iconic part: it's designed so you can plug in your own objects that read the parsed data while it is being parsed β no need for the performance or memory problems that can come from reading in the entire patch all at once. you do this by mimicking one of the existing readers (such as PatchInfoGrabber) and overriding the methods start_patch, start_file, section, end_file and end_patch. periodt. π
okay bye bestie π β this was PatchReader(3) from the User Contributed Perl Documentation, perl v5.42.0, dated 2012-04-15. mwah π«Άβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-PatchReader 0.9.6-bp160.1.11 Β· GPL-2.0+ or Artistic-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms