Slackware-Slackget

 view release on metacpan or  search on metacpan

lib/Slackware/Slackget/GPG/Signature.pm  view on Meta::CPAN


package Slackware::Slackget::GPG::Signature;

use warnings;
use strict;

=head1 NAME

Slackware::Slackget::GPG::Signature - A simple class to represent an output of gpg signature verification.

=head1 VERSION

Version 0.5

=cut

our $VERSION = '0.5';

=head1 SYNOPSIS

A simple class to represent an output of gpg signature verification. This class parse the output of the 'gpg' command line tool.

    use Slackware::Slackget::GPG::Signature;

    my $slackget_gpg_signature_object = Slackware::Slackget::GPG::Signature->new();

=cut

=head1 CONSTRUCTOR

new() : The constructor take the followings arguments :

	- key_id : the id of the key which have been use to sign the file

	- warnings : an array reference which contains all 

	- status : GOOD, BAD or UNKNOW the status of the verification

	- date : date the signature was made

	- emitter : the signature emitter.

	- fingerprint : the primary key fingerprint.



=cut

sub new
{
	my ($class,%args) = @_ ;
	my $self={};
	$self->{DATA}->{key_id} = undef ;
	$self->{DATA}->{key_id} = $args{key_id} if(exists($args{key_id}) && defined($args{key_id})); 
	$self->{DATA}->{'warnings'} = [] ;
	$self->{DATA}->{'warnings'} = $args{warnings} if(exists($args{warnings}) && defined($args{warnings}));
	$self->{DATA}->{status} = undef ;
	$self->{DATA}->{status} = $args{status} if(exists($args{status}) && defined($args{status}));
	$self->{DATA}->{date} = undef ;
	$self->{DATA}->{date} = $args{date} if(exists($args{date}) && defined($args{date}));
	$self->{DATA}->{emitter} = undef ;
	$self->{DATA}->{emitter} = $args{emitter} if(exists($args{emitter}) && defined($args{emitter}));
	$self->{DATA}->{fingerprint} = undef ;
	$self->{DATA}->{fingerprint} = $args{fingerprint} if(exists($args{fingerprint}) && defined($args{fingerprint}));
	bless($self,$class);
	return $self;
}

=head1 METHODS

=head2 is_good

True if the signature is good, false otherwise.

=cut

sub is_good
{
	my ($self) = @_;
	return ($self->{DATA}->{status} eq 'GOOD') ? 1 : 0 ;
}



=head1 ACCESSORS



( run in 0.747 second using v1.01-cache-2.11-cpan-df04353d9ac )