Oops. As of some point one stopped being able to assign integers and
authorNicholas Clark <nick@ccl4.org>
Tue, 12 Dec 2006 22:03:21 +0000 (22:03 +0000)
committerNicholas Clark <nick@ccl4.org>
Tue, 12 Dec 2006 22:03:21 +0000 (22:03 +0000)
floating point values to typeglobs.

p4raw-id: //depot/perl@29539

sv.c
t/op/glob.t

diff --git a/sv.c b/sv.c
index 6211689..b6be97c 100644 (file)
--- 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);
index 03302dc..fd542cb 100755 (executable)
@@ -6,7 +6,7 @@ BEGIN {
 }
 
 require 'test.pl';
-plan( tests => 12 );
+plan( tests => 15 );
 
 @oops = @ops = <op/*>;
 
@@ -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');