{"id":16670195,"url":"https://github.com/xsawyerx/algorithm-diff-callback","last_synced_at":"2026-04-10T21:17:14.314Z","repository":{"id":894837,"uuid":"647435","full_name":"xsawyerx/algorithm-diff-callback","owner":"xsawyerx","description":"Use callbacks on computed differences","archived":false,"fork":false,"pushed_at":"2016-10-14T21:51:56.000Z","size":27,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-12-30T02:41:59.633Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"PlugaDotCo/nfe_io-ruby","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xsawyerx.png","metadata":{"files":{"readme":"README.pod","changelog":"Changes","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-05-04T22:32:36.000Z","updated_at":"2014-09-08T20:54:24.000Z","dependencies_parsed_at":"2022-08-06T10:01:15.256Z","dependency_job_id":null,"html_url":"https://github.com/xsawyerx/algorithm-diff-callback","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xsawyerx/algorithm-diff-callback","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xsawyerx%2Falgorithm-diff-callback","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xsawyerx%2Falgorithm-diff-callback/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xsawyerx%2Falgorithm-diff-callback/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xsawyerx%2Falgorithm-diff-callback/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xsawyerx","download_url":"https://codeload.github.com/xsawyerx/algorithm-diff-callback/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xsawyerx%2Falgorithm-diff-callback/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31659335,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T17:19:37.612Z","status":"ssl_error","status_checked_at":"2026-04-10T17:19:13.364Z","response_time":98,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T11:37:41.417Z","updated_at":"2026-04-10T21:17:14.281Z","avatar_url":"https://github.com/xsawyerx.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"=pod\n\n=encoding UTF-8\n\n=head1 NAME\n\nAlgorithm::Diff::Callback - Use callbacks on computed differences\n\n=head1 VERSION\n\nversion 0.111\n\n=head1 SYNOPSIS\n\nUse callbacks in your diff process to get better control over what will happen.\n\n    use Algorithm::Diff::Callback 'diff_arrays';\n\n    diff_arrays(\n        \\@old_family_members,\n        \\@new_family_members,\n        added   =\u003e sub { say 'Happy to hear about ', shift },\n        deleted =\u003e sub { say 'Sorry to hear about ', shift },\n    );\n\nOr using hashes:\n\n    use Algorithm::Diff::Callback 'diff_hashes';\n\n    diff_hashes(\n        \\%old_details,\n        \\%new_details,\n        added   =\u003e sub { say 'Gained ', shift },\n        deleted =\u003e sub { say 'Lost ',   shift },\n        changed =\u003e sub {\n            my ( $key, $before, $after ) = @_;\n            say \"$key changed from $before to $after\";\n        },\n    );\n\n=head1 DESCRIPTION\n\nOne of the difficulties when using diff modules is that they assume they know\nwhat you want the information for. Some give you formatted output, some give you\njust the values that changes (but neglect to mention how each changed) and some\n(such as L\u003cAlgorithm::Diff\u003e) give you way too much information that you now have\nto skim over and write long complex loops for.\n\nL\u003cAlgorithm::Diff::Callback\u003e let's you pick what you're going to diff (Arrays or\nHashes) and set callbacks for the diff process.\n\n=head1 EXPORT\n\nYou'll need to declare to explicitly export these functions.\n\n=head2 diff_arrays\n\n=head2 diff_hashes\n\n    use Algorithm::Diff::Callback qw\u003cdiff_arrays diff_hashes\u003e;\n\n=head1 SUBROUTINES/METHODS\n\n=head2 diff_arrays(\\@old, \\@new, %callbacks)\n\nThe first two parameters are array references to compare.\n\nThe rest of the parameters are keys for the type of callback you want and the\ncorresponding callback. You can provide multiple callbacks. Supported keys are:\n\n=over 4\n\n=item * added\n\n    diff_arrays(\n        \\@old, \\@new,\n        added =\u003e sub {\n            my $value = shift;\n            say \"$value was added to the array\";\n        }\n    );\n\n=item * deleted\n\n    diff_arrays(\n        \\@old, \\@new,\n        deleted =\u003e sub {\n            my $value = shift;\n            say \"$value was deleted from the array\";\n        }\n    );\n\n=back\n\n=head2 diff_hashes(\\%old, \\%new, %callbacks)\n\nThe first two parameters are hash references to compare.\n\nThe rest of the parameters are keys for the type of callback you want and the\ncorresponding callback. You can provide multiple callbacks. Supported keys are:\n\n=over 4\n\n=item * added\n\n    diff_hashes(\n        \\%old, \\%new,\n        added =\u003e sub {\n            my ( $key, $value ) = @_;\n            say \"$key ($value) was added to the hash\";\n        }\n    );\n\n=item * deleted\n\n    diff_hashes(\n        \\%old, \\%new,\n        deleted =\u003e sub {\n            my ( $key, $value ) = @_;\n            say \"$key ($value) was deleted from the hash\";\n        }\n    );\n\n=item * changed\n\n    diff_hashes(\n        \\%old, \\%new,\n        changed =\u003e sub {\n            my ( $key, $before, $after ) = @_;\n            say \"$key in the hash was changed from $before to $after\";\n        }\n    );\n\n=back\n\n=head1 BUGS\n\nPlease report bugs on the Github issues page at\nL\u003chttp://github.com/xsawyerx/algorithm-diff-callback/issues\u003e.\n\n=head1 SUPPORT\n\nThis module sports 100% test coverage, but in case you have more issues...\n\nYou can find documentation for this module with the perldoc command.\n\n    perldoc Algorithm::Diff::Callback\n\nYou can also look for information at:\n\n=over 4\n\n=item * Github issues tracker\n\nL\u003chttp://github.com/xsawyerx/algorithm-diff-callback/issues\u003e\n\n=item * RT: CPAN's request tracker\n\nL\u003chttp://rt.cpan.org/NoAuth/Bugs.html?Dist=Algorithm-Diff-Callback\u003e\n\n=item * AnnoCPAN: Annotated CPAN documentation\n\nL\u003chttp://annocpan.org/dist/Algorithm-Diff-Callback\u003e\n\n=item * CPAN Ratings\n\nL\u003chttp://cpanratings.perl.org/d/Algorithm-Diff-Callback\u003e\n\n=item * Search CPAN\n\nL\u003chttp://search.cpan.org/dist/Algorithm-Diff-Callback/\u003e\n\n=back\n\n=head1 DEPENDENCIES\n\nL\u003cAlgorithm::Diff\u003e\n\nL\u003cList::MoreUtils\u003e\n\nL\u003cCarp\u003e\n\nL\u003cExporter\u003e\n\n=head1 AUTHOR\n\nSawyer X \u003cxsawyerx@cpan.org\u003e\n\n=head1 COPYRIGHT AND LICENSE\n\nThis software is copyright (c) 2016 by Sawyer X.\n\nThis is free software; you can redistribute it and/or modify it under\nthe same terms as the Perl 5 programming language system itself.\n\n=cut\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxsawyerx%2Falgorithm-diff-callback","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxsawyerx%2Falgorithm-diff-callback","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxsawyerx%2Falgorithm-diff-callback/lists"}