SVN::Dump::Text - A text block from a svn dump


SVN-Dump documentation Contained in the SVN-Dump distribution.

Index


Code Index:

NAME

Top

SVN::Dump::Text - A text block from a svn dump

SYNOPSIS

Top

    # SVN::Dump::Text objects are returned by the read_text_block()
    # method of SVN::Dump::Reader

DESCRIPTION

Top

A SVN::Dump::Text object represents the text of a SVN dump record.

METHODS

Top

The following methods are available:

new( $text )

Create a new SVN::Dump::Text object, initialised with the given text.

get()

Return the text of the SVN::Dump::Text object.

set( $text )

Set the text of the SVN::Dump::Text object.

as_string()

Return a string representation of the text block.

digest( $algo )

Return a digest of the text computed with the $algo algorithm in hexadecimal form. See the Digest module for valid values of $algo.

Return undef if the digest algorithm is not supported.

SEE ALSO

Top

COPYRIGHT & LICENSE

Top


SVN-Dump documentation Contained in the SVN-Dump distribution.

package SVN::Dump::Text;

use strict;
use warnings;

my $NL = "\012";

# blessed string reference
sub new {
    my ( $class, @args ) = @_;
    return bless \( join '', @args ), $class;
}

sub set {
    my ( $self, $text ) = @_;
    $$self = $text;
}
sub get { ${ $_[0] } }
*as_string = \&get;

sub digest {
    my ( $self, $algo ) = @_;
    return eval {
        require Digest;
        Digest->new( uc $algo )->add($$self)->hexdigest;
    };
}

1;

__END__