more LWP bit rot

Anyone know what this shit is and how to stop it?

Use of uninitialized value $vals in index at /usr/local/share/perl5/HTTP/Headers.pm line 277.
Use of uninitialized value $vals in concatenation (.) or string at /usr/local/share/perl5/HTTP/Headers.pm line 280.

I don't know when or why it started, but I've tried all of:

cpan
upgrade HTTP::Headers
upgrade LWP
upgrade HTML::HeadParser
upgrade LWP::UserAgent
upgrade HTTP
upgrade HTTP::Request

/usr/local/share/perl5/HTTP/Headers.pm:our $VERSION = "6.10";

This is on a CentOS machine, not a Mac, in case that matters.

Previously, previously.

Tags: computers, firstperson, lazyweb, linux

6 Responses:

  1. Reini Urban says:

    I don't know why, and I cannot repro it nor had the same bitrot, but I can explain when:

    This HTTP/Headers.pm:277 warning with 6.10 will appear with an empty header value.
    Headers are processed here: $self->_sorted_field_names, the empty value you get is read at my $vals = $self->{$key};

    I debugged it like:
    perl -S -d lwp-request -E -m HEAD https://www.jwz.org/blog/2015/09/more-lwp-bit-rot/
    > b postpone HTTP::Headers::as_string
    > c
    and then when you hit it get a better breakpoint
    > b 264 !$vals
    > c
    and then you see which header is empty, with
    > x $key

    • moof says:

      And you can probably bodge around the warnings in the meantime by changing line 263 of Headers.pm from
      my $vals = $self->{$key};
      to
      my $vals = $self->{$key} // '';
      to force a defined-but-empty value to exist. (Assuming you're using perl 5.10 or higher.)

  2. Ben says:

    I suspect this started with 6.08, or more specifically this commit.

  3. Zak Elep says:

    By not using LWP in the first place?

    Its 2015, there are more options now, like Furl::HTTP and Mojo::UserAgent.

    • Aaron says:

      Yes, let us discard old and predictable brokenness for functionally identical, yet new and exciting, brokenness! Thank God you're here.

Leave a Reply

Your email address will not be published. Required fields are marked *

Connect with Facebook