develooper Front page | perl.perl5.porters | Postings from June 2019

[perl #131867] %{^CAPTURE_ALL} is %+, not %-.

Thread Previous
From:
Hauke D via RT
Date:
June 12, 2019 09:29
Subject:
[perl #131867] %{^CAPTURE_ALL} is %+, not %-.
Message ID:
rt-4.0.24-5675-1560331752-11.131867-14-0@perl.org
Hi,

Bump! Also, I'm confused by the source in gv.c (below), as it *looks* like %{^CAPTURE} is being aliased to %-, and %{^CAPTURE_ALL} to %+, even though according to the documentation, it should be the other way around. But when inspected (attached), *both* %{^CAPTURE} and %{^CAPTURE_ALL} look like %+ ...

/* @{^CAPTURE} %{^CAPTURE} */
if (memEQs(name, len, "\003APTURE")) {
	AV* const av = GvAVn(gv);
	const Size_t n = *name;
	
	sv_magic(MUTABLE_SV(av), (SV*)n, PERL_MAGIC_regdata, NULL, 0);
	SvREADONLY_on(av);
	
	if (sv_type == SVt_PVHV || sv_type == SVt_PVGV)
		require_tie_mod_s(gv, '-', "Tie::Hash::NamedCapture",0);
	
} else /* %{^CAPTURE_ALL} */
if (memEQs(name, len, "\003APTURE_ALL")) {
	if (sv_type == SVt_PVHV || sv_type == SVt_PVGV)
		require_tie_mod_s(gv, '+', "Tie::Hash::NamedCapture",0);
}

For more context: https://www.perlmonks.org/?node_id=11101258

Regards,
-- Hauke D

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About