"Redundant argument in printf" warning on Debug.pm line 98 with perl 5.32
Closed this issue · 3 comments
I also see this in perl5.28 and perl5.30, but I've not been following perl5 development closely enough to know when this changed or broke.
With -w
and use warnings
in effect and Convert::ASN1 version 0.31, calling:
Convert::ASN1::asn_dump(*STDOUT, $str);
where $str is a bunch of raw BER, results in an annoying warning every time line 98 is hit:
Redundant argument in printf at /opt/local/lib/perl5/vendor_perl/5.32/Convert/ASN1/Debug.pm line 98, <> line 1. 0000 1294: SEQUENCE {
I see the same (unsurprisingly) using Net::LDAP's debug(15)
mode.
diff --git a/lib/Convert/ASN1/Debug.pm b/lib/Convert/ASN1/Debug.pm
index 905600b..099189a 100644
--- a/lib/Convert/ASN1/Debug.pm
+++ b/lib/Convert/ASN1/Debug.pm
@@ -95,7 +95,7 @@ sub asn_dump {
my $label = $type{sprintf("%02X",$tag & ~0x20)}
|| $type{sprintf("%02X",$tag & 0xC0)}
|| "[UNIVERSAL %d]";
- printf $label, $tnum;
+ printf "%s: %d\n", $label, $tnum;
if ($tag & ASN_CONSTRUCTOR) {
print " {\n";
You shouldn't include the "\n" in the format string, otherwise LGTM thanks @timlegge !
With the \n and a certificate as data you output:
0000 1294: SEQUENCE: 16
{
0004 64: SEQUENCE: 16
{
0006 9: OBJECT ID: 6
= 1.2.840.113549.1.5.13
0011 51: SEQUENCE: 16
{
[...]
without the \n you output the "nicer" (at least for us ASN.1 fanboys):
0000 1294: SEQUENCE: 16 {
0004 64: SEQUENCE: 16 {
0006 9: OBJECT ID: 6 = 1.2.840.113549.1.5.13
0011 51: SEQUENCE: 16 {
[...]