Diff::LibXDiff(3)

πŸ“¦
version 0.05 Β· 2 versions
, in fedora 43

πŸ’– Diff::LibXDiff πŸ’–

okay so bestie, welcome to the Diff::LibXDiff page β€” it's from the User Contributed Perl Documentation section, and it lives in section 3 of the manual, so it's a library/module page. grab a boba, we're doing diffs πŸ’…


✨ NAME ✨

Diff::LibXDiff β€” calculate a diff with LibXDiff (via XS), no cap πŸ’–

πŸŽ€ VERSION πŸŽ€

Version 0.05 β€” yes, that's the whole version, slay.

🌸 SYNOPSIS 🌸

okay so here's the whole vibe in code form, literally copy-paste it:

use Diff::LibXDiff;

my $string1 = <<_END_
apple
banana
cherry
_END_

my $string2 = <<_END_
apple
grape
cherry
lime
_END_

my $diff = Diff::LibXDiff->diff( $string1, $string2 )
my $bin_diff = Diff::LibXDiff->bdiff( $bin_string1, $bin_string2 )

# $diff is ...

@@ -1,3 +1,4 @@
 apple
-banana
+grape
 cherry
+lime

see how banana got yeeted and grape and lime showed up? that's the whole personality of a diff. iconic πŸ’…

πŸ¦‹ DESCRIPTION πŸ¦‹

Diff::LibXDiff is a binding of LibXDiff (over at <http://www.xmailserver.org/xdiff-lib.html>) to Perl via XS 🫢

and ngl, the flex here is real: LibXDiff is the basis of the diff engine for git πŸ‘‘ so you're literally using the same energy that powers everyone's favorite version control tool.

πŸ’œ METHODS πŸ’œ

$diff = Diff::LibXDiff->diff( $string1, $string2 )

takes $string1 and $string2, figures out the textual diff, and hands you the result back as a string ✨

$patched = Diff::LibXDiff->patch( $original, $patch ) / ( $patched, $rejected ) = Diff::LibXDiff->patch( $original, $patch )

give it an $original string and a $patch string, and it computes the patched string for you πŸ’–

okay important tea: if the patching algorithm can't place a hunk, it returns a second "rejected" result instead β€” but only if you called it in list context. so if you want the rejects, ask for them properly πŸ‘€

$bdiff = Diff::LibXDiff->bdiff( $bin1, $bin2 )

binary diff time 🧚 takes $bin1 and $bin2 and returns the result as a string. it's giving diff but for binaries, lowkey powerful.

$bpatched = Diff::LibXDiff->bpatch( $original, $patch )

and this one calculates the patched binary given an $original string and a $patch string 🩷


πŸ‘‘ AUTHOR πŸ‘‘

Robert Krimen, <rkrimen at cpan.org> πŸ’–

πŸ”₯ SEE ALSO πŸ”₯

πŸ’€ BUGS πŸ’€

found a bug? a feature request? bestie please report it 🫢 send it to bug-diff-libxdiff at rt.cpan.org, or use the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Diff-LibXDiff>.

and here's the deal: the author gets notified, and then you'll automatically be notified of progress on your bug as changes get made. it's a whole mutual-notification situationship, fr fr ✨

πŸ“ SUPPORT πŸ“

you can find documentation for this module with the perldoc command, like so:

perldoc Diff::LibXDiff

and there's more info floating around at these spots:

🌈 ACKNOWLEDGEMENTS 🌈

so this section exists in the original and it is literally empty β€” nothing underneath it, not a single word πŸ’€ keeping it here anyway because we keep every detail, periodt.

Copyright 2009 Robert Krimen, all rights reserved.

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


and that's the whole page, bestie!! πŸŽ€ this was Diff::LibXDiff(3), rendered by perl v5.42.0 and dated 2025-07-25 β€” thanks for reading, mwah πŸ’…πŸ¦‹βœ¨

πŸ“¦ where this page comes from