/usr/share/perl5/SVN/Dump/Property.pm is in libsvn-dump-perl 0.06-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | package SVN::Dump::Property;
use strict;
use warnings;
my $NL = "\012";
# FIXME should I use Tie::Hash::IxHash or Tie::Hash::Indexed?
sub new {
my ( $class, @args ) = @_;
return bless {
keys => [],
hash => {},
}, $class;
}
sub set {
my ( $self, $k, $v ) = @_;
push @{ $self->{keys} }, $k if !exists $self->{hash}->{$k};
$self->{hash}{$k} = $v;
}
sub get { return $_[0]{hash}{ $_[1] }; }
sub keys { return @{ $_[0]{keys} }; }
sub values { return @{ $_[0]{hash} }{ @{ $_[0]{keys} } }; }
sub delete {
my ( $self, @keys ) = @_;
return if !@keys;
my $re = qr/^@{[join '|', map { quotemeta } @keys]}$/;
$self->{keys} = [ grep { !/$re/ } @{ $self->{keys} } ];
delete @{ $self->{hash} }{@keys};
}
sub as_string {
my ($self) = @_;
my $string = '';
$string .=
defined $self->{hash}{$_}
# existing key
? ( "K " . length($_) . $NL ) . "$_$NL"
. ( "V " . length( $self->{hash}{$_} ) . $NL )
. "$self->{hash}{$_}$NL"
# deleted key (v3)
: ( "D " . length($_) . "$NL$_$NL" )
for @{ $self->{keys} };
# end marker
$string .= "PROPS-END$NL";
return $string;
}
1;
__END__
=head1 NAME
SVN::Dump::Property - A property block from a svn dump
=head1 SYNOPSIS
=head1 DESCRIPTION
The SVN::Dump::Property class represents a property block in a svn
dump.
=head1 METHODS
The following methods are available:
=over 4
=item new()
Create a new empty property block.
=item set( $key => $value)
Set the C<$key> property with value C<$value>.
=item get( $key )
Get the value of property C<$key>.
=item delete( @keys )
Delete the keys C<@keys>. Behaves like the builtin C<delete()> on a hash.
=item keys()
Return the property block keys, in the order they were entered.
=item values()
Return the property block values, in the order they were entered.
=item as_string()
Return a string representation of the property block.
=back
=head1 SEE ALSO
L<SVN::Dump>, L<SVN::Dump::Record>.
=head1 COPYRIGHT
Copyright 2006-2013 Philippe Bruhat (BooK), All Rights Reserved.
=head1 LICENSE
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
=cut
|