File Coverage

blib/lib/GnuPG/Fingerprint.pm
Criterion Covered Total %
statement 12 12 100.0
branch 3 4 75.0
path n/a
condition n/a
subroutine 4 4 100.0
pod 1 2 50.0
total 20 22 90.9


line stmt bran path cond sub pod time code
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                
16               package GnuPG::Fingerprint;
17 6       6   20008 use Moo;
  6           8628  
  6           56  
18 6       6   3953 use MooX::late;
  6           29356  
  6           130  
19               with qw(GnuPG::HashInit);
20                
21               has as_hex_string => (
22               isa => 'Any',
23               is => 'rw',
24               );
25                
26               sub compare {
27 8       8 1 92 my ($self, $other) = @_;
28 8 50         52 return 0 unless $other->isa('GnuPG::Fingerprint');
29 8           142 return $self->as_hex_string() eq $other->as_hex_string();
30               }
31                
32               # DEPRECATED
33               sub hex_data
34               {
35 2       2 0 1767 my ( $self, $v ) = @_;
36 2 100         80 $self->as_hex_string( $v ) if defined $v;
37 2           78 return $self->as_hex_string();
38               }
39                
40               1;
41                
42               __END__
43                
44               =head1 NAME
45                
46               GnuPG::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                
55               GnuPG::Fingerprint objects are generally part of GnuPG::Key
56               objects, 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                
66               This methods creates a new object. The optional arguments are
67               initialization of data members.
68                
69               =item hash_init( I<%args> ).
70                
71               =item compare( I<$other> )
72                
73               Returns non-zero only when this fingerprint is identical to the other
74               GnuPG::Fingerprint.
75                
76               =back
77                
78               =head1 OBJECT DATA MEMBERS
79                
80               =over 4
81                
82               =item as_hex_string
83                
84               This is the hex value of the fingerprint that the object embodies,
85               in string format.
86                
87               =back
88                
89               =head1 SEE ALSO
90                
91               L<GnuPG::Key>,
92                
93               =cut