Skip to content

Commit f3803aa

Browse files
committed
Replace Module::Load with require and Module::Load::Conditional with eval
* Maintain compatibility with supported Perl v5.8.1.
1 parent 5f1b6ea commit f3803aa

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

lib/HTTP/Message.pm

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ our $VERSION = '7.02';
77

88
require HTTP::Headers;
99
require Carp;
10-
use Module::Load ();
11-
use Module::Load::Conditional ();
1210

1311
our $MAXIMUM_BODY_SIZE;
1412

@@ -357,7 +355,7 @@ sub decoded_content
357355
$content_ref_iscopy++;
358356
}
359357
elsif ($ce eq 'zstd') {
360-
Module::Load::load('IO::Uncompress::UnZstd');
358+
require IO::Uncompress::UnZstd;
361359
my $buffer;
362360
my $z;
363361
if( defined $content_limit ) {
@@ -530,9 +528,10 @@ sub decodable
530528
require IO::Uncompress::Brotli;
531529
push(@enc, 'br');
532530
};
533-
if( Module::Load::Conditional::check_install( module => 'IO::Compress::Zstd') ) {
531+
eval {
532+
require IO::Compress::Zstd;
534533
push(@enc, "zstd");
535-
}
534+
};
536535
# we don't care about announcing the 'identity', 'base64' and
537536
# 'quoted-printable' stuff
538537
return wantarray ? @enc : join(", ", @enc);
@@ -602,7 +601,7 @@ sub encode
602601
$content =~ tr/A-Za-z/N-ZA-Mn-za-m/;
603602
}
604603
elsif ($encoding eq 'zstd') {
605-
Module::Load::load('IO::Compress::Zstd');
604+
require IO::Compress::Zstd;
606605
my $output;
607606
my $z = IO::Compress::Zstd->new( \$output, Level => 3, Append => 0, Strict => 1, )
608607
or Carp::croak "IO::Compress::Zstd failed: $IO::Compress::Zstd::ZstdError\n";

0 commit comments

Comments
 (0)