Thread [Perl 5.22] LWP, SSL und Bad file descriptor
(28 answers)
Opened by rosti at 2025-02-14 12:51
Moin, mal wieder LWP. Da kriege ich
Code: (dl
)
1 500 Can't connect to www.rationalgalerie.de:443 Und hier mein Perl Code (perl): (dl
)
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 package XHR; # Analog zu JavaScript XHR use strict; use warnings; use HTTP::Request; use LWP::UserAgent; sub new{ my $class = shift; my $callback = shift; bless { ua => LWP::UserAgent->new(), cb => $callback }, $class; } sub request{ my $self = shift; my %par = ( method => 'GET', uri => '', content => '', header => [], @_ ); my $r = HTTP::Request->new( @par{qw(method uri header content)} ); my $res = $self->{ua}->request($r); $self->{cb}->($res); } ########################################################################### package main; use strict; use warnings; sub callback{ my $self = shift; # Response Objekt print $self->as_string; } my $xhr = new XHR(*callback); $xhr->request( uri => 'https://www.rationalgalerie.de/', ); Whats wrong? PS: Mit Request an uri => 'https://example.com' keine Fehler übrigens. Last edited: 2025-02-14 12:53:45 +0100 (CET) |