mirror of
https://github.com/Perl/perl5.git
synced 2026-01-26 16:39:36 +00:00
[perl #97980] Stop tied() from returning a copy
Now tied() returns the actual scalar used to hold the tie object, so one can write weaken(tied $foo).
This commit is contained in:
parent
98be996420
commit
dc456155af
5
pp_sys.c
5
pp_sys.c
@ -973,10 +973,7 @@ PP(pp_tied)
|
||||
RETPUSHUNDEF;
|
||||
|
||||
if ((mg = SvTIED_mg(sv, how))) {
|
||||
SV *osv = SvTIED_obj(sv, mg);
|
||||
if (osv == mg->mg_obj)
|
||||
osv = sv_mortalcopy(osv);
|
||||
PUSHs(osv);
|
||||
PUSHs(SvTIED_obj(sv, mg));
|
||||
RETURN;
|
||||
}
|
||||
RETPUSHUNDEF;
|
||||
|
||||
@ -1180,3 +1180,11 @@ fetching
|
||||
before at - line 8.
|
||||
fetching
|
||||
after at - line 10.
|
||||
########
|
||||
|
||||
# tied returns same value as tie
|
||||
sub TIESCALAR{bless[]}
|
||||
$tyre = \tie $tied, "";
|
||||
print "ok\n" if \tied $tied == $tyre;
|
||||
EXPECT
|
||||
ok
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user