Skip to content

Commit 2881d20

Browse files
committed
Revert "op.c - work around Module::Install::DSL issue"
This reverts commit 451a9a1. We no longer need the Module::Install::DSL workaround. This fixes GH Issue #20233.
1 parent 127965c commit 2881d20

File tree

4 files changed

+2
-43
lines changed

4 files changed

+2
-43
lines changed

op.c

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10711,19 +10711,16 @@ S_process_special_blocks(pTHX_ I32 floor, const char *const fullname,
1071110711
{
1071210712
const char *const colon = strrchr(fullname,':');
1071310713
const char *const name = colon ? colon + 1 : fullname;
10714-
int is_module_install_hack = 0;
1071510714

1071610715
PERL_ARGS_ASSERT_PROCESS_SPECIAL_BLOCKS;
1071710716

1071810717
if (*name == 'B') {
10719-
module_install_hack:
10720-
if (strEQ(name, "BEGIN") || is_module_install_hack) {
10718+
if (strEQ(name, "BEGIN")) {
1072110719
const I32 oldscope = PL_scopestack_ix;
1072210720
SV *max_nest_sv = NULL;
1072310721
IV max_nest_iv;
1072410722
dSP;
1072510723
(void)CvGV(cv);
10726-
is_module_install_hack = 0;
1072710724
if (floor) LEAVE_SCOPE(floor);
1072810725
ENTER;
1072910726

@@ -10849,30 +10846,6 @@ S_process_special_blocks(pTHX_ I32 floor, const char *const fullname,
1084910846
return FALSE;
1085010847
} else if (*name == 'I') {
1085110848
if (strEQ(name, "INIT")) {
10852-
#ifdef MI_INIT_WORKAROUND_PACK
10853-
{
10854-
HV *hv= CvSTASH(cv);
10855-
STRLEN len = hv ? HvNAMELEN(hv) : 0;
10856-
char *pv= (len == sizeof(MI_INIT_WORKAROUND_PACK)-1)
10857-
? HvNAME_get(hv) : NULL;
10858-
if ( pv && strEQ(pv,MI_INIT_WORKAROUND_PACK) )
10859-
{
10860-
/* old versions of Module::Install::DSL contain code
10861-
* that creates an INIT in eval, which expect to run
10862-
* after an exit(0) in BEGIN. This unfortunately
10863-
* breaks a lot of code in the CPAN river. So we magically
10864-
* convert INIT blocks from Module::Install::DSL to
10865-
* be BEGIN blocks. Which works out, since the INIT
10866-
* blocks it creates are eval'ed so are late.
10867-
*/
10868-
Perl_warn(aTHX_ "Treating %s::INIT block as BEGIN block as workaround",
10869-
MI_INIT_WORKAROUND_PACK);
10870-
is_module_install_hack = 1;
10871-
goto module_install_hack;
10872-
}
10873-
10874-
}
10875-
#endif
1087610849
if (PL_main_start)
1087710850
/* diag_listed_as: Too late to run %s block */
1087810851
Perl_ck_warner(aTHX_ packWARN(WARN_VOID),

op.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1166,7 +1166,6 @@ struct op_argcheck_aux {
11661166
char slurpy; /* presence of slurpy: may be '\0', '@' or '%' */
11671167
};
11681168

1169-
#define MI_INIT_WORKAROUND_PACK "Module::Install::DSL"
11701169

11711170
/*
11721171
* ex: set ts=8 sts=4 sw=4 et:

pod/perldiag.pod

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6414,15 +6414,6 @@ C<$tr> or C<$y> may cause this error.
64146414
(F) The lexer couldn't find the final delimiter of a tr///, tr[][],
64156415
y/// or y[][] construct.
64166416

6417-
=item Treating %s::INIT block as BEGIN block as workaround
6418-
6419-
(S) A package is using an old version of C<Module::Install::DSL> to
6420-
install, which makes unsafe assumptions about when INIT blocks will be
6421-
called. Because C<Module::Install::DSL> is used to install other modules
6422-
and is difficult to upgrade we have a special workaround in place to
6423-
deal with this. Unless you are a maintainer of an affected module you
6424-
can ignore this warning. We emit it only as a sanity check.
6425-
64266417
=item '%s' trapped by operation mask
64276418

64286419
(F) You tried to use an operator from a Safe compartment in which it's

t/op/blocks.t

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ BEGIN {
66
set_up_inc('../lib');
77
}
88

9-
plan tests => 23;
9+
plan tests => 22;
1010

1111
my @expect = qw(
1212
b1
@@ -261,7 +261,3 @@ TODO: {
261261

262262
fresh_perl_is('eval "BEGIN {goto end}"; end:', '', {}, 'RT #113934: goto out of BEGIN causes assertion failure');
263263

264-
fresh_perl_is('package Module::Install::DSL; BEGIN { eval "INIT { print q(INIT fired in eval) }" }',
265-
"Treating Module::Install::DSL::INIT block as BEGIN block as workaround at (eval 1) line 1.\n"
266-
."INIT fired in eval", {},
267-
'GH Issue #16300: Module::Install::DSL workaround');

0 commit comments

Comments
 (0)