NAME
WWW::Keycloak::Diff - Compare a Keycloak representation with the wanted state, without I/O
VERSION
version 0.001
SYNOPSIS
my $changes = WWW::Keycloak::Diff->changes( $current, { enabled => \1, attributes => { a => 'b' } } );
return unless %$changes; # nothing to do
my $full = WWW::Keycloak::Diff->merge( $current, $wanted );
DESCRIPTION
The comparison behind every ensure_* method of WWW::Keycloak::Admin, kept free of I/O so that Net::Async::Keycloak uses the very same code.
Only the keys of the wanted state are looked at. Hashes are compared key by key, so a wanted attributes hash with one entry checks that entry and leaves the others alone. Lists of plain values are compared as sets, because Keycloak returns lists such as redirectUris sorted; lists holding structures are compared in order. Booleans compare equal whatever their spelling: \1, a JSON true, "true" and 1 are the same value, and so are \0, a JSON false, "false" and 0. Everything else is compared as a string, so 3600 and "3600" are equal.
changes
my $changes = WWW::Keycloak::Diff->changes( \%current, \%wanted );
The keys that have to be written to turn the current state into the wanted one, as a hash. A nested hash that differs comes back merged with its current content, because Keycloak replaces such a hash as a whole. Empty when there is nothing to do.
merge
my $full = WWW::Keycloak::Diff->merge( \%current, \%wanted );
The current state with the wanted keys laid over it, nested hashes merged key by key.
same
WWW::Keycloak::Diff->same( $a, $b )
True when two values are the same in the sense described above.
SUPPORT
Issues
Please report bugs and feature requests on GitHub at https://github.com/Getty/p5-www-keycloak/issues.
IRC
Join #kubernetes on irc.perl.org or message Getty directly.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <getty@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.