From: Toby Inkster <mail@tobyinkster.co.uk>
Date: Mon, 31 Mar 2025 12:31:51 +0100
Subject: use newer Mite
Origin: https://github.com/tobyink/p5-sub-handlesvia/commit/9bc3cfb22ade4b407413ae1c746bb331fff52954
Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2025-30673

---
 lib/Sub/HandlesVia/CodeGenerator.pm.mite.pm   |  8 +-
 lib/Sub/HandlesVia/Handler.pm.mite.pm         | 74 +++++++++----------
 lib/Sub/HandlesVia/Mite.pm                    | 24 +++---
 lib/Sub/HandlesVia/Toolkit.pm.mite.pm         |  6 +-
 lib/Sub/HandlesVia/Toolkit/Mite.pm.mite.pm    |  2 +-
 lib/Sub/HandlesVia/Toolkit/Moo.pm.mite.pm     |  2 +-
 lib/Sub/HandlesVia/Toolkit/Moose.pm.mite.pm   |  2 +-
 lib/Sub/HandlesVia/Toolkit/Mouse.pm.mite.pm   |  2 +-
 .../HandlesVia/Toolkit/ObjectPad.pm.mite.pm   |  2 +-
 lib/Sub/HandlesVia/Toolkit/Plain.pm.mite.pm   |  2 +-
 10 files changed, 65 insertions(+), 59 deletions(-)

diff --git a/lib/Sub/HandlesVia/CodeGenerator.pm.mite.pm b/lib/Sub/HandlesVia/CodeGenerator.pm.mite.pm
index 602362f1617a..fdfd52c126fe 100644
--- a/lib/Sub/HandlesVia/CodeGenerator.pm.mite.pm
+++ b/lib/Sub/HandlesVia/CodeGenerator.pm.mite.pm
@@ -7,7 +7,7 @@
 
     our $USES_MITE    = "Mite::Class";
     our $MITE_SHIM    = "Sub::HandlesVia::Mite";
-    our $MITE_VERSION = "0.012000";
+    our $MITE_VERSION = "0.013000";
 
     # Mite keywords
     BEGIN {
@@ -67,8 +67,8 @@
                 map { "$_\::BUILD" } reverse @$linear_isa
             ],
             DEMOLISH => [
-                map   { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () }
-                  map { "$_\::DEMOLISH" } @$linear_isa
+                map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () }
+                map { "$_\::DEMOLISH" } @$linear_isa
             ],
             HAS_BUILDARGS        => $class->can('BUILDARGS'),
             HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'),
@@ -128,7 +128,7 @@
 
                 package Sub::HandlesVia::Mite;
                 !ref $args->{"coerce"}
-                  and (!defined $args->{"coerce"}
+                  and ( !defined $args->{"coerce"}
                     or $args->{"coerce"} eq q()
                     or $args->{"coerce"} eq '0'
                     or $args->{"coerce"} eq '1' );
diff --git a/lib/Sub/HandlesVia/Handler.pm.mite.pm b/lib/Sub/HandlesVia/Handler.pm.mite.pm
index 6d313aa76049..7eac84148115 100644
--- a/lib/Sub/HandlesVia/Handler.pm.mite.pm
+++ b/lib/Sub/HandlesVia/Handler.pm.mite.pm
@@ -7,7 +7,7 @@
 
     our $USES_MITE    = "Mite::Class";
     our $MITE_SHIM    = "Sub::HandlesVia::Mite";
-    our $MITE_VERSION = "0.012000";
+    our $MITE_VERSION = "0.013000";
 
     # Mite keywords
     BEGIN {
@@ -67,8 +67,8 @@
                 map { "$_\::BUILD" } reverse @$linear_isa
             ],
             DEMOLISH => [
-                map   { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () }
-                  map { "$_\::DEMOLISH" } @$linear_isa
+                map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () }
+                map { "$_\::DEMOLISH" } @$linear_isa
             ],
             HAS_BUILDARGS        => $class->can('BUILDARGS'),
             HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'),
@@ -275,7 +275,7 @@
                     (
                         (
                             !ref $to_coerce
-                              and (!defined $to_coerce
+                              and ( !defined $to_coerce
                                 or $to_coerce eq q()
                                 or $to_coerce eq '0'
                                 or $to_coerce eq '1' )
@@ -287,7 +287,7 @@
                 };
                 (
                     !ref $coerced_value
-                      and (!defined $coerced_value
+                      and ( !defined $coerced_value
                         or $coerced_value eq q()
                         or $coerced_value eq '0'
                         or $coerced_value eq '1' )
@@ -307,7 +307,7 @@
                     (
                         (
                             !ref $to_coerce
-                              and (!defined $to_coerce
+                              and ( !defined $to_coerce
                                 or $to_coerce eq q()
                                 or $to_coerce eq '0'
                                 or $to_coerce eq '1' )
@@ -319,7 +319,7 @@
                 };
                 (
                     !ref $coerced_value
-                      and (!defined $coerced_value
+                      and ( !defined $coerced_value
                         or $coerced_value eq q()
                         or $coerced_value eq '0'
                         or $coerced_value eq '1' )
@@ -339,7 +339,7 @@
                     (
                         (
                             !ref $to_coerce
-                              and (!defined $to_coerce
+                              and ( !defined $to_coerce
                                 or $to_coerce eq q()
                                 or $to_coerce eq '0'
                                 or $to_coerce eq '1' )
@@ -351,7 +351,7 @@
                 };
                 (
                     !ref $coerced_value
-                      and (!defined $coerced_value
+                      and ( !defined $coerced_value
                         or $coerced_value eq q()
                         or $coerced_value eq '0'
                         or $coerced_value eq '1' )
@@ -375,7 +375,7 @@
                     (
                         (
                             !ref $to_coerce
-                              and (!defined $to_coerce
+                              and ( !defined $to_coerce
                                 or $to_coerce eq q()
                                 or $to_coerce eq '0'
                                 or $to_coerce eq '1' )
@@ -387,7 +387,7 @@
                 };
                 (
                     !ref $coerced_value
-                      and (!defined $coerced_value
+                      and ( !defined $coerced_value
                         or $coerced_value eq q()
                         or $coerced_value eq '0'
                         or $coerced_value eq '1' )
@@ -411,7 +411,7 @@
                     (
                         (
                             !ref $to_coerce
-                              and (!defined $to_coerce
+                              and ( !defined $to_coerce
                                 or $to_coerce eq q()
                                 or $to_coerce eq '0'
                                 or $to_coerce eq '1' )
@@ -423,7 +423,7 @@
                 };
                 (
                     !ref $coerced_value
-                      and (!defined $coerced_value
+                      and ( !defined $coerced_value
                         or $coerced_value eq q()
                         or $coerced_value eq '0'
                         or $coerced_value eq '1' )
@@ -701,7 +701,7 @@
                         (
                             (
                                 !ref $to_coerce
-                                  and (!defined $to_coerce
+                                  and ( !defined $to_coerce
                                     or $to_coerce eq q()
                                     or $to_coerce eq '0'
                                     or $to_coerce eq '1' )
@@ -713,7 +713,7 @@
                     };
                     (
                         !ref $default_value
-                          and (!defined $default_value
+                          and ( !defined $default_value
                             or $default_value eq q()
                             or $default_value eq '0'
                             or $default_value eq '1' )
@@ -940,7 +940,7 @@
 
     our $USES_MITE    = "Mite::Class";
     our $MITE_SHIM    = "Sub::HandlesVia::Mite";
-    our $MITE_VERSION = "0.012000";
+    our $MITE_VERSION = "0.013000";
 
     # Mite keywords
     BEGIN {
@@ -1179,7 +1179,7 @@
                     (
                         (
                             !ref $to_coerce
-                              and (!defined $to_coerce
+                              and ( !defined $to_coerce
                                 or $to_coerce eq q()
                                 or $to_coerce eq '0'
                                 or $to_coerce eq '1' )
@@ -1191,7 +1191,7 @@
                 };
                 (
                     !ref $coerced_value
-                      and (!defined $coerced_value
+                      and ( !defined $coerced_value
                         or $coerced_value eq q()
                         or $coerced_value eq '0'
                         or $coerced_value eq '1' )
@@ -1211,7 +1211,7 @@
                     (
                         (
                             !ref $to_coerce
-                              and (!defined $to_coerce
+                              and ( !defined $to_coerce
                                 or $to_coerce eq q()
                                 or $to_coerce eq '0'
                                 or $to_coerce eq '1' )
@@ -1223,7 +1223,7 @@
                 };
                 (
                     !ref $coerced_value
-                      and (!defined $coerced_value
+                      and ( !defined $coerced_value
                         or $coerced_value eq q()
                         or $coerced_value eq '0'
                         or $coerced_value eq '1' )
@@ -1243,7 +1243,7 @@
                     (
                         (
                             !ref $to_coerce
-                              and (!defined $to_coerce
+                              and ( !defined $to_coerce
                                 or $to_coerce eq q()
                                 or $to_coerce eq '0'
                                 or $to_coerce eq '1' )
@@ -1255,7 +1255,7 @@
                 };
                 (
                     !ref $coerced_value
-                      and (!defined $coerced_value
+                      and ( !defined $coerced_value
                         or $coerced_value eq q()
                         or $coerced_value eq '0'
                         or $coerced_value eq '1' )
@@ -1279,7 +1279,7 @@
                     (
                         (
                             !ref $to_coerce
-                              and (!defined $to_coerce
+                              and ( !defined $to_coerce
                                 or $to_coerce eq q()
                                 or $to_coerce eq '0'
                                 or $to_coerce eq '1' )
@@ -1291,7 +1291,7 @@
                 };
                 (
                     !ref $coerced_value
-                      and (!defined $coerced_value
+                      and ( !defined $coerced_value
                         or $coerced_value eq q()
                         or $coerced_value eq '0'
                         or $coerced_value eq '1' )
@@ -1315,7 +1315,7 @@
                     (
                         (
                             !ref $to_coerce
-                              and (!defined $to_coerce
+                              and ( !defined $to_coerce
                                 or $to_coerce eq q()
                                 or $to_coerce eq '0'
                                 or $to_coerce eq '1' )
@@ -1327,7 +1327,7 @@
                 };
                 (
                     !ref $coerced_value
-                      and (!defined $coerced_value
+                      and ( !defined $coerced_value
                         or $coerced_value eq q()
                         or $coerced_value eq '0'
                         or $coerced_value eq '1' )
@@ -1492,7 +1492,7 @@
 
     our $USES_MITE    = "Mite::Class";
     our $MITE_SHIM    = "Sub::HandlesVia::Mite";
-    our $MITE_VERSION = "0.012000";
+    our $MITE_VERSION = "0.013000";
 
     # Mite keywords
     BEGIN {
@@ -1747,7 +1747,7 @@
                     (
                         (
                             !ref $to_coerce
-                              and (!defined $to_coerce
+                              and ( !defined $to_coerce
                                 or $to_coerce eq q()
                                 or $to_coerce eq '0'
                                 or $to_coerce eq '1' )
@@ -1759,7 +1759,7 @@
                 };
                 (
                     !ref $coerced_value
-                      and (!defined $coerced_value
+                      and ( !defined $coerced_value
                         or $coerced_value eq q()
                         or $coerced_value eq '0'
                         or $coerced_value eq '1' )
@@ -1779,7 +1779,7 @@
                     (
                         (
                             !ref $to_coerce
-                              and (!defined $to_coerce
+                              and ( !defined $to_coerce
                                 or $to_coerce eq q()
                                 or $to_coerce eq '0'
                                 or $to_coerce eq '1' )
@@ -1791,7 +1791,7 @@
                 };
                 (
                     !ref $coerced_value
-                      and (!defined $coerced_value
+                      and ( !defined $coerced_value
                         or $coerced_value eq q()
                         or $coerced_value eq '0'
                         or $coerced_value eq '1' )
@@ -1811,7 +1811,7 @@
                     (
                         (
                             !ref $to_coerce
-                              and (!defined $to_coerce
+                              and ( !defined $to_coerce
                                 or $to_coerce eq q()
                                 or $to_coerce eq '0'
                                 or $to_coerce eq '1' )
@@ -1823,7 +1823,7 @@
                 };
                 (
                     !ref $coerced_value
-                      and (!defined $coerced_value
+                      and ( !defined $coerced_value
                         or $coerced_value eq q()
                         or $coerced_value eq '0'
                         or $coerced_value eq '1' )
@@ -1847,7 +1847,7 @@
                     (
                         (
                             !ref $to_coerce
-                              and (!defined $to_coerce
+                              and ( !defined $to_coerce
                                 or $to_coerce eq q()
                                 or $to_coerce eq '0'
                                 or $to_coerce eq '1' )
@@ -1859,7 +1859,7 @@
                 };
                 (
                     !ref $coerced_value
-                      and (!defined $coerced_value
+                      and ( !defined $coerced_value
                         or $coerced_value eq q()
                         or $coerced_value eq '0'
                         or $coerced_value eq '1' )
@@ -1883,7 +1883,7 @@
                     (
                         (
                             !ref $to_coerce
-                              and (!defined $to_coerce
+                              and ( !defined $to_coerce
                                 or $to_coerce eq q()
                                 or $to_coerce eq '0'
                                 or $to_coerce eq '1' )
@@ -1895,7 +1895,7 @@
                 };
                 (
                     !ref $coerced_value
-                      and (!defined $coerced_value
+                      and ( !defined $coerced_value
                         or $coerced_value eq q()
                         or $coerced_value eq '0'
                         or $coerced_value eq '1' )
diff --git a/lib/Sub/HandlesVia/Mite.pm b/lib/Sub/HandlesVia/Mite.pm
index e35186f3059d..96c582daa4e4 100644
--- a/lib/Sub/HandlesVia/Mite.pm
+++ b/lib/Sub/HandlesVia/Mite.pm
@@ -17,13 +17,9 @@ or do {
 };
 
 # Constants
-sub true  () { !!1 }
-sub false () { !!0 }
-sub ro    () { 'ro' }
-sub rw    () { 'rw' }
-sub rwp   () { 'rwp' }
-sub lazy  () { 'lazy' }
-sub bare  () { 'bare' }
+sub true  () { !!1 }    sub false () { !!0 }
+sub ro    () { 'ro' }   sub rw    () { 'rw' }   sub rwp   () { 'rwp' }
+sub lazy  () { 'lazy' } sub bare  () { 'bare' }
 
 # More complicated constants
 BEGIN {
@@ -109,9 +105,19 @@ sub import {
         );
     }
     else {
+        # Try to determine original filename for caller, minus libdir.
+        # This would normally be in %INC but caller hasn't finished loading yet.
+        require File::Spec;
+        my $orig = $file;
+        for my $base ( @INC ) {
+            $base eq substr $file, 0, length $base
+            and -f File::Spec->catfile( $base, substr $file, 1 + length $base )
+            and $orig = File::Spec->abs2rel( $file, $base )
+            and last;
+        }
+
         # Changes to this filename must be coordinated with Mite::Compiled
-        my $mite_file = $file . '.mite.pm';
-        local @INC = ( '.', @INC );
+        my $mite_file = $orig . '.mite.pm';
         local $@;
         if ( not eval { require $mite_file; 1 } ) {
             my $e = $@;
diff --git a/lib/Sub/HandlesVia/Toolkit.pm.mite.pm b/lib/Sub/HandlesVia/Toolkit.pm.mite.pm
index df7b5beade61..6185776a0654 100644
--- a/lib/Sub/HandlesVia/Toolkit.pm.mite.pm
+++ b/lib/Sub/HandlesVia/Toolkit.pm.mite.pm
@@ -7,7 +7,7 @@
 
     our $USES_MITE    = "Mite::Class";
     our $MITE_SHIM    = "Sub::HandlesVia::Mite";
-    our $MITE_VERSION = "0.012000";
+    our $MITE_VERSION = "0.013000";
 
     # Mite keywords
     BEGIN {
@@ -42,8 +42,8 @@
                 map { "$_\::BUILD" } reverse @$linear_isa
             ],
             DEMOLISH => [
-                map   { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () }
-                  map { "$_\::DEMOLISH" } @$linear_isa
+                map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () }
+                map { "$_\::DEMOLISH" } @$linear_isa
             ],
             HAS_BUILDARGS        => $class->can('BUILDARGS'),
             HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'),
diff --git a/lib/Sub/HandlesVia/Toolkit/Mite.pm.mite.pm b/lib/Sub/HandlesVia/Toolkit/Mite.pm.mite.pm
index fef68bb66580..e54b784c698a 100644
--- a/lib/Sub/HandlesVia/Toolkit/Mite.pm.mite.pm
+++ b/lib/Sub/HandlesVia/Toolkit/Mite.pm.mite.pm
@@ -7,7 +7,7 @@
 
     our $USES_MITE    = "Mite::Class";
     our $MITE_SHIM    = "Sub::HandlesVia::Mite";
-    our $MITE_VERSION = "0.012000";
+    our $MITE_VERSION = "0.013000";
 
     # Mite keywords
     BEGIN {
diff --git a/lib/Sub/HandlesVia/Toolkit/Moo.pm.mite.pm b/lib/Sub/HandlesVia/Toolkit/Moo.pm.mite.pm
index 3b56b2986bc8..6a3db5feb044 100644
--- a/lib/Sub/HandlesVia/Toolkit/Moo.pm.mite.pm
+++ b/lib/Sub/HandlesVia/Toolkit/Moo.pm.mite.pm
@@ -7,7 +7,7 @@
 
     our $USES_MITE    = "Mite::Class";
     our $MITE_SHIM    = "Sub::HandlesVia::Mite";
-    our $MITE_VERSION = "0.012000";
+    our $MITE_VERSION = "0.013000";
 
     # Mite keywords
     BEGIN {
diff --git a/lib/Sub/HandlesVia/Toolkit/Moose.pm.mite.pm b/lib/Sub/HandlesVia/Toolkit/Moose.pm.mite.pm
index 8e74fe1fc77a..de3a14de2bf4 100644
--- a/lib/Sub/HandlesVia/Toolkit/Moose.pm.mite.pm
+++ b/lib/Sub/HandlesVia/Toolkit/Moose.pm.mite.pm
@@ -7,7 +7,7 @@
 
     our $USES_MITE    = "Mite::Class";
     our $MITE_SHIM    = "Sub::HandlesVia::Mite";
-    our $MITE_VERSION = "0.012000";
+    our $MITE_VERSION = "0.013000";
 
     # Mite keywords
     BEGIN {
diff --git a/lib/Sub/HandlesVia/Toolkit/Mouse.pm.mite.pm b/lib/Sub/HandlesVia/Toolkit/Mouse.pm.mite.pm
index e884a1468a47..c0fe5f8fb0f5 100644
--- a/lib/Sub/HandlesVia/Toolkit/Mouse.pm.mite.pm
+++ b/lib/Sub/HandlesVia/Toolkit/Mouse.pm.mite.pm
@@ -7,7 +7,7 @@
 
     our $USES_MITE    = "Mite::Class";
     our $MITE_SHIM    = "Sub::HandlesVia::Mite";
-    our $MITE_VERSION = "0.012000";
+    our $MITE_VERSION = "0.013000";
 
     # Mite keywords
     BEGIN {
diff --git a/lib/Sub/HandlesVia/Toolkit/ObjectPad.pm.mite.pm b/lib/Sub/HandlesVia/Toolkit/ObjectPad.pm.mite.pm
index 29ee1d925c20..73c5ea8645b3 100644
--- a/lib/Sub/HandlesVia/Toolkit/ObjectPad.pm.mite.pm
+++ b/lib/Sub/HandlesVia/Toolkit/ObjectPad.pm.mite.pm
@@ -7,7 +7,7 @@
 
     our $USES_MITE    = "Mite::Class";
     our $MITE_SHIM    = "Sub::HandlesVia::Mite";
-    our $MITE_VERSION = "0.012000";
+    our $MITE_VERSION = "0.013000";
 
     # Mite keywords
     BEGIN {
diff --git a/lib/Sub/HandlesVia/Toolkit/Plain.pm.mite.pm b/lib/Sub/HandlesVia/Toolkit/Plain.pm.mite.pm
index f122c702661b..76a744e01046 100644
--- a/lib/Sub/HandlesVia/Toolkit/Plain.pm.mite.pm
+++ b/lib/Sub/HandlesVia/Toolkit/Plain.pm.mite.pm
@@ -7,7 +7,7 @@
 
     our $USES_MITE    = "Mite::Class";
     our $MITE_SHIM    = "Sub::HandlesVia::Mite";
-    our $MITE_VERSION = "0.012000";
+    our $MITE_VERSION = "0.013000";
 
     # Mite keywords
     BEGIN {
-- 
2.49.0

