From: Gurusamy Sarathy Date: Tue, 1 Jun 1999 15:55:55 +0000 (+0000) Subject: change#3447 didn't do enough to exempt Foo->bar(qw/.../) from X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=58a40671cc13fcd5c38641be59cb1e7f87a5e905;p=p5sagit%2Fp5-mst-13.2.git change#3447 didn't do enough to exempt Foo->bar(qw/.../) from strict 'subs' p4raw-link: @3447 on //depot/perl: 7a52d87a7fbc7848e6b3e9e96db52d4070212cca p4raw-id: //depot/perl@3514 --- diff --git a/op.c b/op.c index c1c6066..3914245 100644 --- a/op.c +++ b/op.c @@ -5381,6 +5381,11 @@ ck_subr(OP *o) else if (cvop->op_type == OP_METHOD) { if (o2->op_type == OP_CONST) o2->op_private &= ~OPpCONST_STRICT; + else if (o2->op_type == OP_LIST) { + OP *o = ((UNOP*)o2)->op_first->op_sibling; + if (o && o->op_type == OP_CONST) + o->op_private &= ~OPpCONST_STRICT; + } } o->op_private |= (PL_hints & HINT_STRICT_REFS); if (PERLDB_SUB && PL_curstash != PL_debstash) diff --git a/t/pragma/strict-subs b/t/pragma/strict-subs index 61ec286..deeb381 100644 --- a/t/pragma/strict-subs +++ b/t/pragma/strict-subs @@ -277,3 +277,25 @@ my $a = Fred ; EXPECT Bareword "Fred" not allowed while "strict subs" in use at - line 8. Execution of - aborted due to compilation errors. +######## + +# see if Foo->Bar(...) etc work under strictures +use strict; +package Foo; sub Bar { print "@_\n" } +Foo->Bar('a',1); +Bar Foo ('b',2); +Foo->Bar(qw/c 3/); +Bar Foo (qw/d 4/); +Foo::->Bar('A',1); +Bar Foo:: ('B',2); +Foo::->Bar(qw/C 3/); +Bar Foo:: (qw/D 4/); +EXPECT +Foo a 1 +Foo b 2 +Foo c 3 +Foo d 4 +Foo A 1 +Foo B 2 +Foo C 3 +Foo D 4