From f38c76527a94a96b527c1ae276372c147f67a36f Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Fri, 17 May 2024 00:31:59 +0200 Subject: [PATCH 1/3] use Cpanel::JSON::XS everywhere --- cpanfile | 1 - lib/MetaCPAN/Middleware/Static.pm | 4 ++-- lib/MetaCPAN/Web/Controller/Account.pm | 6 +++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/cpanfile b/cpanfile index a0fe98d9565..48dc94d5a33 100644 --- a/cpanfile +++ b/cpanfile @@ -41,7 +41,6 @@ requires 'HTTP::Request::Common'; requires 'IO::Async::Loop'; requires 'IO::Async::SSL'; requires 'IO::Socket::SSL'; -requires 'JSON::MaybeXS' => '1.004000'; requires 'List::Util', '1.45'; requires 'Locale::Country','3.62'; requires 'Log::Dispatch'; diff --git a/lib/MetaCPAN/Middleware/Static.pm b/lib/MetaCPAN/Middleware/Static.pm index 76e61a3fc98..4f641343fc9 100644 --- a/lib/MetaCPAN/Middleware/Static.pm +++ b/lib/MetaCPAN/Middleware/Static.pm @@ -5,7 +5,7 @@ use Plack::Builder qw( builder enable mount ); use Plack::App::File (); use Cwd qw( cwd ); use Plack::MIME (); -use JSON::MaybeXS (); +use Cpanel::JSON::XS (); Plack::MIME->add_type( '.eot' => 'application/vnd.ms-fontobject', @@ -34,7 +34,7 @@ sub wrap { or die "can't find asset map"; my $json = do { local $/; <$fh> }; close $fh; - my $files = JSON::MaybeXS->new->decode($json); + my $files = Cpanel::JSON::XS->new->decode($json); return [ map "/assets/$_", @$files ]; }; diff --git a/lib/MetaCPAN/Web/Controller/Account.pm b/lib/MetaCPAN/Web/Controller/Account.pm index c7eb4f83388..514b13d202a 100644 --- a/lib/MetaCPAN/Web/Controller/Account.pm +++ b/lib/MetaCPAN/Web/Controller/Account.pm @@ -5,7 +5,7 @@ use Moose; BEGIN { extends 'MetaCPAN::Web::Controller' } use MetaCPAN::Web::RenderUtil (); -use JSON::MaybeXS (); +use Cpanel::JSON::XS (); sub auto : Private { my ( $self, $c ) = @_; @@ -36,7 +36,7 @@ sub login_status : Local : Args(0) : Auth(0) { my $output = $c->{stash}{json} ||= {}; if ( my $user = $c->user ) { - $output->{logged_in} = JSON::MaybeXS::true; + $output->{logged_in} = Cpanel::JSON::XS::true; if ( my $pause_id = $user->pause_id ) { # this is not a complete author record, but enough for now @@ -62,7 +62,7 @@ sub login_status : Local : Args(0) : Auth(0) { $c->forward('/account/favorite/list_as_json'); } else { - $c->stash->{json}{logged_in} = JSON::MaybeXS::false; + $c->stash->{json}{logged_in} = Cpanel::JSON::XS::false; $c->cdn_max_age('30d'); } } From 2d825818b3b404a7e9b53f36696712f70c324d6c Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Fri, 17 May 2024 00:32:28 +0200 Subject: [PATCH 2/3] remove use of MetaCPAN::Moose It was only used in one class and isn't really needed. --- cpanfile | 1 - lib/MetaCPAN/Web/Model/ReleaseInfo.pm | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/cpanfile b/cpanfile index 48dc94d5a33..9cd0b37d772 100644 --- a/cpanfile +++ b/cpanfile @@ -46,7 +46,6 @@ requires 'Locale::Country','3.62'; requires 'Log::Dispatch'; requires 'Log::Log4perl::Catalyst'; requires 'Log::Log4perl::Layout::JSON'; -requires 'MetaCPAN::Moose'; requires 'MetaCPAN::Role', '0.06'; requires 'Module::Build::Tiny', '0.037'; requires 'Module::Runtime'; diff --git a/lib/MetaCPAN/Web/Model/ReleaseInfo.pm b/lib/MetaCPAN/Web/Model/ReleaseInfo.pm index 6739a663023..34acd175474 100644 --- a/lib/MetaCPAN/Web/Model/ReleaseInfo.pm +++ b/lib/MetaCPAN/Web/Model/ReleaseInfo.pm @@ -2,7 +2,7 @@ package MetaCPAN::Web::Model::ReleaseInfo; use strict; use warnings; -use MetaCPAN::Moose; +use Moose; extends 'Catalyst::Model'; From ab654493feeebab679cacdaf8024bd9922dd2656 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Fri, 17 May 2024 01:35:19 +0200 Subject: [PATCH 3/3] remove a number of no longer used prereqs --- cpanfile | 8 -------- 1 file changed, 8 deletions(-) diff --git a/cpanfile b/cpanfile index 9cd0b37d772..5d4c7b2adc7 100644 --- a/cpanfile +++ b/cpanfile @@ -1,8 +1,6 @@ use strict; use warnings; -requires 'Capture::Tiny'; -requires 'Carton', '1.0.34'; requires 'Catalyst', '5.90103'; requires 'Catalyst::Action::RenderView'; requires 'Catalyst::Authentication::User'; @@ -24,14 +22,11 @@ requires 'Data::Pageset'; requires 'DateTime', '1.24'; requires 'DateTime::Format::HTTP'; requires 'DateTime::Format::ISO8601'; -requires 'Devel::Confess'; requires 'Digest::SHA'; requires 'Encode', '2.51'; requires 'Exporter'; requires 'File::Path'; requires 'Future'; -requires 'Gazelle'; -requires 'Getopt::Long::Descriptive'; requires 'HTML::Escape'; requires 'HTML::Restrict', '2.2.2'; requires 'HTML::Tree'; @@ -51,11 +46,8 @@ requires 'Module::Build::Tiny', '0.037'; requires 'Module::Runtime'; requires 'Moo', '2.000002'; requires 'Moose', '2.1605'; -requires 'MooseX::Fastly::Role', '0.03'; requires 'Net::Async::HTTP'; -requires 'Net::Fastly', '1.05'; requires 'Number::Format'; -requires 'Parallel::ForkManager', '1.19'; requires 'Params::ValidationCompiler'; requires 'Path::Tiny', '0.076'; requires 'Plack', '1.0039';