File: Signature.pm

package info (click to toggle)
librdf-rdfa-generator-perl 0.102-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 280 kB
  • sloc: perl: 2,747; xml: 192; makefile: 11
file content (58 lines) | stat: -rw-r--r-- 1,326 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#line 1
package Test::Signature;

use 5.004;
use strict;
use vars qw( $VERSION @ISA @EXPORT @EXPORT_OK );
use Exporter;
use Test::Builder;

BEGIN {
    $VERSION   = '1.10';
    @ISA       = qw( Exporter );
    @EXPORT    = qw( signature_ok );
    @EXPORT_OK = qw( signature_force_ok );
}

my $test = Test::Builder->new();

#line 53

#line 77

sub action_skip { $test->skip( $_[0] ) }
sub action_ok { $test->ok( 0, $_[0] ) }

sub signature_ok {
    my $name  = shift || 'Valid signature';
    my $force = shift || 0;
    my $action = $force ? \&action_ok : \&action_skip;
  SKIP: {
        if ( !-s 'SIGNATURE' ) {
            $action->("No SIGNATURE file found.");
        }
        elsif ( !eval { require Module::Signature; 1 } ) {
            $action->(
                    "Next time around, consider installing Module::Signature, "
                  . "so you can verify the integrity of this distribution." );
        }
        elsif ( !eval { require Socket; Socket::inet_aton('pgp.mit.edu') } ) {
            $action->("Cannot connect to the keyserver.");
        }
        else {
            $test->ok( Module::Signature::verify() ==
                  Module::Signature::SIGNATURE_OK() => $name );
        }
    }
}

#line 118

sub signature_force_ok {
    signature_ok( $_[0] || undef, 1 );
}

1;
__END__

#line 297