SVN::TXN::Props - Provides a hash interface to Subversion transaction properties
use SVN::TXN::Props qw(get_txn_props); my $repository_path = '/svnrepo'; my $txn_name = '1-0'; my $props = get_txn_props($repository_path, $txn_name); $props->{'svn:author'} = 'nobody'; my %props; tie %props, 'SVN::TXN::Props', $repository_path, $txn_name; $props{'svn:author'} = 'nobody'; my $txn = SVN::Repos::open($repository_path)->fs->open_txn($txn_name); $props = get_txn_props($txn); tie %props, 'SVN::TXN::Props', $txn; my @paths = keys %{tied(%props)->txn->root->paths_changed()};
Maps properties from a subversion transaction to a hash. This allows for reading and manipulating properties of active subversion transactions before the transaction is commited, for example during a pre-commit hook script.
This module provides a tied hash interface, allowing it to be used with the perl tie function, eg:
use SVN::TXN::Props; tie %props, 'SVN::TXN::Props', $repository_path, $txn_name; $props{'svn:author'} = 'nobody';
The arguments to the tie function can either be the path to a repository and the name of a transaction, or an already open transaction object:
my $txn = SVN::Repos::open($repository_path)->fs->open_txn($txn_name); tie %props, 'SVN::TXN::Props', $txn;
Alternatively, the function get_txn_props can be imported, which will returned an already tied hash reference, eg:
use SVN::TXN::Props qw(get_txn_props); my $props = get_txn_props($repository_path, $txn_name); $props->{'svn:author'} = 'nobody';
As with the tie call, a single open transaction object can be passed to get_txn_props instead of the repository_path and txn_name.
The underlying SVN::TXN::Props object is returned by the tie call, or can be obtained from the tied hash using the perl tied() function. This provides a single method txn() that will return the underlying subversion transaction object, eg:
my $txn_props = tie %props, 'SVN::TXN::Props', $repository_path, $txn_name; my @paths = keys %{$txn_props->txn->root->paths_changed()};
SVN::Repo, SVN::Fs
Chris Leishman, <chris@leishman.org>
Copyright (C) 2007 by Chris Leishman
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.
To install SVN::TXN::Props, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SVN::TXN::Props
CPAN shell
perl -MCPAN -e shell install SVN::TXN::Props
For more information on module installation, please visit the detailed CPAN module installation guide.