SVN::H...Generic(3pm)

πŸ“¦
version 1.36 Β· 3 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

SVN::Hooks::Generic β€” bestie, it implements generic checks for all Subversion hooks. That's the whole vibe. πŸŽ€


✨ VERSION ✨

version 1.36 β€” yes she's got a number, she's official, she's versioned πŸ’…


🌸 SYNOPSIS 🌸

Okay so real talk first: this SVN::Hooks plugin lets you easily write generic checks for all Subversion standard hooks. Cute, right? But… it's deprecated. 🫠 Not me being the bearer of bad news, but you should use the SVN::Hooks hook-defining exported directives instead. That's the move. Periodt.

This module gets configured by the following directive, and she's a big one:

πŸ¦‹ GENERIC(HOOK => FUNCTION, HOOK => [FUNCTIONS], ...) πŸ¦‹

This directive associates FUNCTION with a specific HOOK. And like, you're not limited to one β€” you can make more than one association with a single directive call, or you can use multiple calls to make multiple associations. Do it however feels right for you, bestie. πŸ’–

Moreover (love that word), you can associate a hook with a single function or with a list of functions (passing them as elements of an array). And heads up: all functions associated with a hook will be called in an unspecified order with the same arguments. So don't go assuming a sequence, okay? πŸ™ˆ

Each hook must be associated with functions with a specific signature β€” i.e., the arguments that get passed to the function depend on the hook it's associated with. Signature match or it's a no from her. πŸ’…

The hooks are specified by their standard names. Iconic of them honestly.

The function signatures are the following:

post-commit(SVN::Look)
post-lock(repos-path, username)
post-revprop-change(SVN::Look, username, property-name, action)
post-unlock(repos-path, username)
pre-commit(SVN::Look)
pre-lock(repos-path, path, username, comment, steal-lock-flag)
pre-revprop-change(SVN::Look, username, property-name, action)
pre-unlock(repos-path, path, username, lock-token, break-unlock-flag)
start-commit(repos-path, username, capabilities, txt-name)

The functions may perform whatever checks they want β€” go off, be creative, the world is yours 🌈. If the checks succeed, the function must simply return. That's it. Just return. Slay.

Otherwise? They must die with a suitable error message. 😭 That error message gets sent back to the user performing the Subversion action which triggered the hook. So write something nice-ish, bestie, someone's gonna read it.

The sketch below shows how this directive could be used. It's giving tutorial:

sub my_start_commit {
    my ($repo_path, $username, $capabilities, $txt_name) = @_;
    # ...
}

sub my_pre_commit {
    my ($svnlook) = @_;
    # ...
}

GENERIC(
    'start-commit' => \&my_start_commit,
    'pre-commit'   => \&my_pre_commit,
);

See how clean that is? Obsessed. πŸ’œ


πŸ‘‘ AUTHOR πŸ‘‘

Gustavo L. de M. Chaves <gnustavo@cpan.org> β€” the icon, the legend, the main character who wrote this. 🫢


This software is copyright (c) 2022 by CPqD <www.cpqd.com.br>. 🏒✨

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. So like, go forth and share, fr fr. πŸ“


⭐ Also shoutout to the header energy: this is the SVN::H...Generic(3pm) page from the User Contributed Perl Documentation β€” that's the manual name, and now you know it. πŸ’–

And that's a wrap, bestie! πŸ¦‹ This one came to you from perl v5.36.0, dated 2022-09-11, and it's the SVN::H...Generic(3pm) page. Stan a well-documented hook. Mwah. πŸ’…πŸ’œπŸŒΈ

πŸ“¦ where this page comes from