1#  Fingerprint.pm
2#    - providing an object-oriented approach to GnuPG key fingerprints
3#
4#  Copyright (C) 2000 Frank J. Tobin <ftobin@cpan.org>
5#
6#  This module is free software; you can redistribute it and/or modify it
7#  under the same terms as Perl itself.
8#
9#  This program is distributed in the hope that it will be useful,
10#  but WITHOUT ANY WARRANTY; without even the implied warranty of
11#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12#
13#  $Id: Fingerprint.pm,v 1.8 2001/08/21 13:31:50 ftobin Exp $
14#
15
16package GnuPG::Fingerprint;
17use Moo;
18use MooX::late;
19with qw(GnuPG::HashInit);
20
21has as_hex_string => (
22    isa => 'Any',
23    is  => 'rw',
24);
25
26sub compare {
27  my ($self, $other) = @_;
28  return 0 unless $other->isa('GnuPG::Fingerprint');
29  return $self->as_hex_string() eq $other->as_hex_string();
30}
31
32# DEPRECATED
33sub hex_data
34{
35    my ( $self, $v ) = @_;
36    $self->as_hex_string( $v ) if defined $v;
37    return $self->as_hex_string();
38}
39
401;
41
42__END__
43
44=head1 NAME
45
46GnuPG::Fingerprint - GnuPG Fingerprint Objects
47
48=head1 SYNOPSIS
49
50  # assumes a GnuPG::Key in $key
51  my $fingerprint = $key->fingerprint->as_hex_string();
52
53=head1 DESCRIPTION
54
55GnuPG::Fingerprint objects are generally part of GnuPG::Key
56objects, and are not created on their own.
57
58=head1 OBJECT METHODS
59
60=head2 Initialization Methods
61
62=over 4
63
64=item new( I<%initialization_args> )
65
66This methods creates a new object.  The optional arguments are
67initialization of data members.
68
69=item hash_init( I<%args> ).
70
71=item compare( I<$other> )
72
73Returns non-zero only when this fingerprint is identical to the other
74GnuPG::Fingerprint.
75
76=back
77
78=head1 OBJECT DATA MEMBERS
79
80=over 4
81
82=item as_hex_string
83
84This is the hex value of the fingerprint that the object embodies,
85in string format.
86
87=back
88
89=head1 SEE ALSO
90
91L<GnuPG::Key>,
92
93=cut
94