File: cpansign

package info (click to toggle)
libmodule-signature-perl 0.93-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 372 kB
  • sloc: perl: 829; makefile: 6
file content (121 lines) | stat: -rw-r--r-- 2,509 bytes parent folder | download
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/usr/bin/perl
use strict;
use Module::Signature;

# PODNAME: cpansign
my $VERSION = '0.07';


$Module::Signature::Verbose = 1;

my %cmd = (
    s => 'sign',
    v => 'verify',
    h => 'help',
);

my $op = $ARGV[0]; $op =~ s/^--?// if defined $op;
my $dwim;
if (!$op or $op eq 'skip' or -e $op) {
    $op = (-e 'SIGNATURE' ? 'verify' : 'sign');
    $dwim = 1;
}

my $cmd = $cmd{substr($op, 0, 1)};
(system("perldoc $0"), exit) if $cmd eq 'help';
my @args;
push @args, (overwrite => '1')    if $cmd eq 'sign';
push @args, (skip => '1')    if grep /^-?-?skip/, @ARGV;

if (my $sub = Module::Signature->can($cmd)) {
    if (@ARGV and -e $ARGV[-1]) {
        require PAR::Dist;
        PAR::Dist::_verify_or_sign(
            dist => $ARGV[-1],
            $dwim ? () : (action => $cmd, @args)
        );
    }
    else {
        #if ($cmd eq 'sign') {
        #    exit unless Module::Signature::verify();
        #}
        exit($sub->(@args));
    }
}
else {
    die "Unknown command: '$op'.\n".
        "Available actions: " . (join(', ', sort values %cmd)) .  ".\n";
}

exit;

__END__

=pod

=encoding UTF-8

=head1 NAME

cpansign

=head1 VERSION

version 0.93

=head1 SYNOPSIS

    % cpansign              # verify an existing SIGNATURE, or
                            # make a new one if none exists

    % cpansign file.par     # verify or sign a PAR file

    % cpansign sign         # make signature; overwrites existing one
    % cpansign -s           # same thing

    % cpansign verify       # verify a signature
    % cpansign -v           # same thing
    % cpansign -v --skip    # ignore files in MANIFEST.SKIP

    % cpansign help         # display this documentation
    % cpansign -h           # same thing

=head1 DESCRIPTION

This utility lets you create and verify SIGNATURE files.

=head1 NAME

cpansign - CPAN signature management utility

=head1 SEE ALSO

L<Module::Signature>

=head1 AUTHORS

Audrey Tang E<lt>autrijus@autrijus.orgE<gt>

=head1 LICENSE

This work is under the B<CC0 1.0 Universal> license.

To the extent possible under law, 唐鳳 has waived all copyright and related
or neighboring rights to Module-Signature.

This work is published from Taiwan.

L<http://creativecommons.org/publicdomain/zero/1.0>

=head1 AUTHOR

Audrey Tang <cpan@audreyt.org>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2025 by waved.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut