Thank you very much!
Certainly $SIG{__DIE__} = sub {warn @_} makes the difference.
Even you helped me already, if you could give me a clue to investigate further the
interference of $SIG{__DIE__} = ...


Following two test programs. First one with SIG handler, second one, without SIG handler.

With this program I get the reported message:
#!/usr/bin/perl -w

use strict;
use Cwd qw( abs_path );

my $CW_DIR = abs_path;
my $BASE_URL = 'https://www.openbsd.org/';

my $UA = "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0";

local $SIG{ __DIE__ } = sub {  ## Whenever die, restore cwd
  my $message = shift;
  warn $message;
  chdir( $CW_DIR ) or warn "Couldn't change to directory ", $CW_DIR, ": $!";
  exit 1;
};

base_get();

sub base_get {
  use HTTP::Tiny;

  my $ua = HTTP::Tiny->new( agent => $UA );
  my $response = $ua->get($BASE_URL);

  die "Failed getting web page!" unless $response->{success};

  print "$response->{status} $response->{reason}\n";

  if ( $response->{success} and length $response->{content} ) {
    print "Web page size: ", length $response->{content}, "\n";
    my $content_page = $response->{content};
  } else {
    warn "No content!\n";
  }
}

With this program everything is ok (no message):
#!/usr/bin/perl -w

use strict;
use Cwd qw( abs_path );

my $CW_DIR = abs_path;
my $BASE_URL = 'https://www.openbsd.org/';

my $UA = "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0";

base_get();

sub base_get {
  use HTTP::Tiny;

  my $ua = HTTP::Tiny->new( agent => $UA );
  my $response = $ua->get($BASE_URL);

  die "Failed getting web page!" unless $response->{success};

  print "$response->{status} $response->{reason}\n";

  if ( $response->{success} and length $response->{content} ) {
    print "Web page size: ", length $response->{content}, "\n";
    my $content_page = $response->{content};
  } else {
    warn "No content!\n";
  }
}


Thanks and greetings!
Daniel

Quoting Alexander Bluhm <alexander.bl...@gmx.net>:

On Mon, Dec 10, 2018 at 08:00:16PM +0100, d...@dandat.net wrote:
use HTTP::Tiny;
my $ua = HTTP::Tiny->new( agent => $UA );
my $response = $ua->get($BASE_URL);

Is this your complete Perl program?  Or just an excerpt?  Can you
provide a minimal program that triggers the bug.  Obviously in your
example $UA and $BASE_URL are undefined.

I get this error:

Use of uninitialized value $url in pattern match (m//) at /usr/libdata/perl5/HTTP/Tiny.pm line 836. Use of uninitialized value $url in concatenation (.) or string at /usr/libdata/perl5/HTTP/Tiny.pm line 836.

I'm getting this message:
Your vendor has not defined SSLeay macro TLS1_3_VERSION at
/usr/local/libdata/perl5/site_perl/IO/Socket/SSL.pm line 104.

Do you have code like this somewhere in your program?

$SIG{__DIE__} = sub {warn @_}

I don't think your problem is OpenBSD specific.  But on systems
with OpenSSL 1.1 it cannot happen.

bluhm



Reply via email to