You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a script directly using ReadonlyX and also using another module which, in turn, uses Readonly (note: no "X"). This leads to a bunch of warnings of the following kind:
Prototype mismatch: sub Readonly::Scalar ($$) vs ($;$) at C:/perl/perl/site/lib/ReadonlyX.pm line 19.
Prototype mismatch: sub Readonly::Readonly ([$@%]@) vs ([%@$]$) at C:/perl/perl/site/lib/ReadonlyX.pm line 20.
Subroutine Array redefined at C:/perl/perl/site/lib/ReadonlyX.pm line 22.
Subroutine Hash redefined at C:/perl/perl/site/lib/ReadonlyX.pm line 32.
Prototype mismatch: sub Readonly::Scalar ($$) vs ($;$) at C:/perl/perl/site/lib/ReadonlyX.pm line 50.
Subroutine Scalar redefined at C:/perl/perl/site/lib/ReadonlyX.pm line 42.
Prototype mismatch: sub Readonly::Readonly ([$@%]@) vs ([%@$]$) at C:/perl/perl/site/lib/ReadonlyX.pm line 58.
Subroutine Readonly redefined at C:/perl/perl/site/lib/ReadonlyX.pm line 52.
Subroutine Clone redefined at C:/perl/perl/site/lib/ReadonlyX.pm line 95.
To reproduce:
use strict;
use warnings;
use ReadonlyX;
use Graph::Dijkstra;
In this specific case, I can just skip using ReadonlyX and revert my script to Readonly, since I control this script. Conceivably however, one might run into the situation where one third-party module's use of Readonly clashes with another third party module's use of ReadonlyX.
I'm not sure I would call this a bug in ReadonlyX, but it's certainly an issue.
The text was updated successfully, but these errors were encountered:
Here's what seems to work...but apparently there are differences between ReadonlyX and Readonly that might trip you up if you rely on the nuances/bugs of Readonly.
BEGIN {
use Module::Loaded;
use ReadonlyX;
mark_as_loaded('Readonly');
}
This also gets you the speed improvements of using ReadonlyX vs Readonly.
1/14/23 - follow - up
Readonly and ReadonlyX are not necessarily drop in replacements as I said above, so the technique used here might have to be reversed...that is use Readonly and mark ReadonlyX as loaded...I found this when maintaining some code that uses File::BOM which uses Readonly and in a manner incompatible with ReadonlyX.
I have a script directly using ReadonlyX and also using another module which, in turn, uses Readonly (note: no "X"). This leads to a bunch of warnings of the following kind:
Prototype mismatch: sub Readonly::Scalar ($$) vs ($;$ ) at C:/perl/perl/site/lib/ReadonlyX.pm line 19.$;$ ) at C:/perl/perl/site/lib/ReadonlyX.pm line 50.
Prototype mismatch: sub Readonly::Readonly ([$@%]@) vs ([%@$]$) at C:/perl/perl/site/lib/ReadonlyX.pm line 20.
Subroutine Array redefined at C:/perl/perl/site/lib/ReadonlyX.pm line 22.
Subroutine Hash redefined at C:/perl/perl/site/lib/ReadonlyX.pm line 32.
Prototype mismatch: sub Readonly::Scalar ($$) vs (
Subroutine Scalar redefined at C:/perl/perl/site/lib/ReadonlyX.pm line 42.
Prototype mismatch: sub Readonly::Readonly ([$@%]@) vs ([%@$]$) at C:/perl/perl/site/lib/ReadonlyX.pm line 58.
Subroutine Readonly redefined at C:/perl/perl/site/lib/ReadonlyX.pm line 52.
Subroutine Clone redefined at C:/perl/perl/site/lib/ReadonlyX.pm line 95.
To reproduce:
In this specific case, I can just skip using ReadonlyX and revert my script to Readonly, since I control this script. Conceivably however, one might run into the situation where one third-party module's use of Readonly clashes with another third party module's use of ReadonlyX.
I'm not sure I would call this a bug in ReadonlyX, but it's certainly an issue.
The text was updated successfully, but these errors were encountered: