File Coverage

blib/lib/Crypt/OpenPGP/UserID.pm
Criterion Covered Total %
statement 26 26 100.0
branch 2 2 100.0
condition n/a
subroutine 9 9 100.0
pod 4 5 80.0
total 41 42 97.6


line stmt bran cond sub pod time code
1             package Crypt::OpenPGP::UserID;
2 9     9   823 use strict;
  9         26  
  9         478  
3 9     9   71 use warnings;
  9         29  
  9         828  
4              
5             our $VERSION = '1.19'; # VERSION
6              
7 9     9   58 use Crypt::OpenPGP::ErrorHandler;
  9         17  
  9         375  
8 9     9   51 use base qw( Crypt::OpenPGP::ErrorHandler );
  9         17  
  9         3678  
9              
10             sub new {
11 37     37 1 1561 my $id = bless { }, shift;
12 37         160 $id->init(@_);
13             }
14              
15             sub init {
16 37     37 0 95 my $id = shift;
17 37         101 my %param = @_;
18 37 100       176 if (my $ident = $param{Identity}) {
19 3         29 $id->{id} = $ident;
20             }
21 37         114 $id;
22             }
23              
24 53     53 1 540 sub id { $_[0]->{id} }
25             sub parse {
26 34     34 1 93 my $class = shift;
27 34         139 my($buf) = @_;
28 34         222 my $id = $class->new;
29 34         144 $id->{id} = $buf->bytes;
30 34         526 $id;
31             }
32              
33 7     7 1 50 sub save { $_[0]->{id} }
34              
35             1;
36             __END__