<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package CPANPLUS::Module::Signature;
use deprecate;

use strict;

use Cwd;
use CPANPLUS::Error;
use Params::Check               qw[check];
use Module::Load::Conditional   qw[can_load];
use vars qw[$VERSION];
$VERSION = "0.9135";

### detached sig, not actually used afaik --kane ###
#sub get_signature {
#    my $self = shift;
#
#    my $clone = $self-&gt;clone;
#    $clone-&gt;package( $self-&gt;package . '.sig' );
#
#    return $clone-&gt;fetch;
#}

sub check_signature {
    my $self = shift;
    my $cb = $self-&gt;parent;
    my $conf = $cb-&gt;configure_object;
    my %hash = @_;

    my $verbose;
    my $tmpl = {
        verbose =&gt; {default =&gt; $conf-&gt;get_conf('verbose'), store =&gt; \$verbose},
    };

    check( $tmpl, \%hash ) or return;

    my $dir = $self-&gt;status-&gt;extract or (
                error( loc( "Do not know what dir '%1' was extracted to; ".
                            "Cannot check signature", $self-&gt;module ) ),
                return );

    my $cwd = cwd();
    unless( $cb-&gt;_chdir( dir =&gt; $dir ) ) {
        error(loc(  "Could not chdir to '%1', cannot verify distribution '%2'",
                    $dir, $self-&gt;module ));
        return;
    }


    ### check prerequisites
    my $flag;
    my $use_list = { 'Module::Signature' =&gt; '0.06' };
    if( can_load( modules =&gt; $use_list, verbose =&gt; 1 ) ) {
        my $rv = Module::Signature::verify();

        unless ($rv eq Module::Signature::SIGNATURE_OK() or
            $rv eq Module::Signature::SIGNATURE_MISSING()
        ) {
            $flag++;    # whoops, bad sig
        }
    }

    $cb-&gt;_chdir( dir =&gt; $cwd );
    return $flag ? 0 : 1;
}

1;
</pre></body></html>