From a4e7257dd5734b5e4017740dcd64afe11faac2eb Mon Sep 17 00:00:00 2001 From: Dan Book Date: Tue, 13 Aug 2024 00:46:52 -0400 Subject: [PATCH] deprecate use of old package separator ' in Mojo::Loader::load_class --- lib/Mojo/Loader.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Mojo/Loader.pm b/lib/Mojo/Loader.pm index 1331dc633f..f65e44adb9 100644 --- a/lib/Mojo/Loader.pm +++ b/lib/Mojo/Loader.pm @@ -4,7 +4,7 @@ use Mojo::Base -strict; use Exporter qw(import); use Mojo::Exception; use Mojo::File qw(path); -use Mojo::Util qw(b64_decode class_to_path); +use Mojo::Util qw(b64_decode class_to_path deprecated); our @EXPORT_OK = qw(data_section file_is_binary find_modules find_packages load_class load_classes); @@ -42,6 +42,9 @@ sub load_class { # Invalid class name return 1 if ($class || '') !~ /^\w(?:[\w:']*\w)?$/; + deprecated + q{Calling Mojo::Loader::load_class with a class name using the old package separator "'" is deprecated; use "::"} + if $class =~ m/'/; # Load if not already loaded return undef if $class->can('new') || eval "require $class; 1";