Subject: | Use of uninitialized value $version in concatenation (.) or string at /usr/share/perl5/News/Article/NoCeM.pm line 208 |
Date: | Thu, 6 Sep 2018 11:37:34 +0200 |
To: | bug-News-Article-NoCeM [...] rt.cpan.org |
From: | Florian Schlichting <florian.schlichting [...] fu-berlin.de> |
Hi,
News::Article::NoCeM uses PGP::Sign to create a PGP signature, however
PGP::Sign makes no promises that the PGP version is returned along with
the signature. From its manpage:
In a scalar context, pgp_sign() returns the signature as an
ASCII-armored block with embedded newlines (but no trailing
newline). In a list context, it returns a two-element list
consisting of the signature as above and the PGP version that signed
it (if that information was present in the signature).
Recent changes to gpg (gpg1 being provided by gpg2, I think) cause the
Version: line to be absent, hence the second list element returned by
pgp_sign becomes undef and the above warning is emitted.
May I suggest the following, simple change:
$self->add_body($body);
$self->add_body("");
$self->add_body("-----BEGIN PGP SIGNATURE-----");
- $self->add_body("Version: $version");
+ $self->add_body("Version: $version") if $version;
$self->add_body("");
$self->add_body($signature);
$self->add_body("-----END PGP SIGNATURE-----");
Thanks,
Florian