From 010be86bae505fbe309b6252cc560b0e9370f49d Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Tue, 12 Dec 2006 22:03:21 +0000 Subject: [PATCH] Oops. As of some point one stopped being able to assign integers and floating point values to typeglobs. p4raw-id: //depot/perl@29539 --- sv.c | 5 +++++ t/op/glob.t | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/sv.c b/sv.c index 6211689..b6be97c 100644 --- a/sv.c +++ b/sv.c @@ -3376,6 +3376,8 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, register SV *sstr, I32 flags) case SVt_PV: sv_upgrade(dstr, SVt_PVIV); break; + case SVt_PVGV: + goto end_of_first_switch; } (void)SvIOK_only(dstr); SvIV_set(dstr, SvIVX(sstr)); @@ -3402,6 +3404,8 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, register SV *sstr, I32 flags) case SVt_PVIV: sv_upgrade(dstr, SVt_PVNV); break; + case SVt_PVGV: + goto end_of_first_switch; } SvNV_set(dstr, SvNVX(sstr)); (void)SvNOK_only(dstr); @@ -3474,6 +3478,7 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, register SV *sstr, I32 flags) else SvUPGRADE(dstr, (svtype)stype); } + end_of_first_switch: /* dstr may have been upgraded. */ dtype = SvTYPE(dstr); diff --git a/t/op/glob.t b/t/op/glob.t index 03302dc..fd542cb 100755 --- a/t/op/glob.t +++ b/t/op/glob.t @@ -6,7 +6,7 @@ BEGIN { } require 'test.pl'; -plan( tests => 12 ); +plan( tests => 15 ); @oops = @ops = ; @@ -85,3 +85,10 @@ SKIP: { } cmp_ok(scalar(@oops),'>',0,'glob globbed something'); + +*aieee = 4; +pass('Can assign integers to typeglobs'); +*aieee = 3.14; +pass('Can assign floats to typeglobs'); +*aieee = 'pi'; +pass('Can assign strings to typeglobs'); -- 2.7.4