Text::...tedHTML(3pm)

πŸ’– NAME πŸ’–

okay bestie, so this is the Text::...tedHTML(3pm) page from User Contributed Perl Documentation, and the module it's about is Text::Diff::FormattedHTML β€” it generates a colorful HTML diff of strings and files. like, you give it two things, it hands you back a pretty HTML table showing what's different. it's giving GitHub diff view energy, but make it yours. πŸ¦‹


✨ VERSION ✨

Version 0.08 β€” yes, that's the version. write it down, bestie. πŸ’…


🌸 SYNOPSIS 🌸

so here's the whole vibe, fr fr:

use Text::Diff::FormattedHTML;

my $output = diff_files($file1, $file2);

# for strings

my $output = diff_strings( { vertical => 1 }, $file1, $file2);

# as you might want some CSS:
open OUT, ">diff.html";
print OUT "<style type='text/css'>\n", diff_css(), "</style>\n";
print OUT diff_files('fileA', 'fileB');
close OUT;

see how diff_files just... works? iconic. and if you're doing strings, diff_strings takes an options hashref first β€” that { vertical => 1 } right there? that's you being fancy. then diff_css() gives you the styling so your output isn't naked. periodt. πŸŽ€


🌈 DESCRIPTION 🌈

Presents in a (nice?) HTML table the difference between two files or strings. Inspired on GitHub diff view.

^(the "(nice?)" with the question mark is the original author's own words, not mine, I'm just the messenger 🫢 β€” I think it's nice, ngl.)


πŸ‘‘ SUBROUTINES πŸ‘‘

🧚 diff_files

my $html = diff_files("filename1", "filename2");

diff_files and diff_strings support a first optional argument (an hash reference) where options can be set.

Valid options are:

  • vertical β€” Can be set to a true value, for a more compact table. πŸ”₯
  • limit_onesided β€” Makes tables look nicer when there is a side with too many new lines. 😭 (we've all been there)

so basically: hashref first if you want to tweak, then your two filenames. that's the whole thing.

πŸ’œ diff_strings

my $html = diff_strings("string1", "string2");

Compare strings. First split by newline, and then treat them as file content (see function above).

translation bestie: it chops your strings up by newline, then runs them through the exact same machinery as diff_files. same options hashref, same energy. slay. ✨

🩷 diff_css

my $css = diff_css;

Return the default css. You are invited to override it.

not me reminding you that "invited to override it" is literally the author asking you to make it your own. go off, restyle the whole diff, main character energy only. πŸ’…

🫢 AUTHOR 🫢

Alberto Simoes, <ambs at cpan.org> β€” king behavior, honestly. πŸ‘‘


πŸ’€ BUGS πŸ’€

Please report any bugs or feature requests to bug-text-diff-formattedhtml at rt.cpan.org, or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Text-Diff-FormattedHTML>.

I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

so like, you tell him, he tells you back when it's fixed. communication?? in my CPAN?? it's more likely than you think. πŸ™ˆ


⭐ SUPPORT ⭐

You can find documentation for this module with the perldoc command.

perldoc Text::Diff::FormattedHTML

You can also look for information at:

  • RT: CPAN's request tracker (report bugs here)

<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Text-Diff-FormattedHTML>

  • AnnoCPAN: Annotated CPAN documentation

<http://annocpan.org/dist/Text-Diff-FormattedHTML>

  • CPAN Ratings

<http://cpanratings.perl.org/d/Text-Diff-FormattedHTML>

  • Search CPAN

<http://search.cpan.org/dist/Text-Diff-FormattedHTML/>

four whole links, bestie. that's four places to lurk. iykyk. πŸ¦‹


πŸ’œ ACKNOWLEDGEMENTS πŸ’œ

...okay so this section is literally empty in the original. no names, no thanks, nothing. not a single shoutout. it's giving mysterious. it's giving humble. we love a quiet legend. 🌸


Copyright 2011 Alberto Simoes.

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.

so, like, either license works, pick your fighter. both are valid, both are free, no drama. πŸ’…

and that's the whole page, bestie!! 🌈✨ this was Text::...tedHTML(3pm) β€” the User Contributed Perl Documentation version, generated by perl v5.32.1, dated 2021-09-29. thank you for coming to my ted talk, go diff something beautiful. πŸ«ΆπŸ’–πŸŽ€

πŸ“¦ where this page comes from