---
name: "Text::Diff::FormattedHTML"
section: "3pm"
platform: "linux"
package: "libtext-diff-formattedhtml-perl"
version: "0.08-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Text::Diff::FormattedHTML"
---

# Text::Diff::FormattedHTML(3pm)

Generate a colorful HTML diff of strings/files.

## NAME

Text::Diff::FormattedHTML - Generate a colorful HTML diff of strings/files.

## VERSION

Version 0.08

## SYNOPSIS

```
    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;
```

## DESCRIPTION

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

## 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.

### diff\_strings

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

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

### diff\_css

```
   my $css = diff_css;
```

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

## AUTHOR

Alberto Simoes, `"<ambs at cpan.org>"`

## 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.

## 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/\>

## ACKNOWLEDGEMENTS

## LICENSE AND COPYRIGHT

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.
