⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 refs

📁 source of perl for linux application,
💻
字号:
Check strict refs functionality__END__# no strict, should build & run ok.my $fred ;$b = "fred" ;$a = $$b ;$c = ${"def"} ;$c = @{"def"} ;$c = %{"def"} ;$c = *{"def"} ;$c = \&{"def"} ;$c = def->[0];$c = def->{xyz};EXPECT######### strict refs - erroruse strict ;my $fred ;my $a = ${"fred"} ;EXPECTCan't use string ("fred") as a SCALAR ref while "strict refs" in use at - line 5.######### strict refs - erroruse strict 'refs' ;my $fred ;my $a = ${"fred"} ;EXPECTCan't use string ("fred") as a SCALAR ref while "strict refs" in use at - line 5.######### strict refs - erroruse strict 'refs' ;my $fred ;my $b = "fred" ;my $a = $$b ;EXPECTCan't use string ("fred") as a SCALAR ref while "strict refs" in use at - line 6.######### strict refs - erroruse strict 'refs' ;my $b ;my $a = $$b ;EXPECTCan't use an undefined value as a SCALAR reference at - line 5.######### strict refs - erroruse strict 'refs' ;my $b ;my $a = @$b ;EXPECTCan't use an undefined value as an ARRAY reference at - line 5.######### strict refs - erroruse strict 'refs' ;my $b ;my $a = %$b ;EXPECTCan't use an undefined value as a HASH reference at - line 5.######### strict refs - erroruse strict 'refs' ;my $b ;my $a = *$b ;EXPECTCan't use an undefined value as a symbol reference at - line 5.######### strict refs - erroruse strict 'refs' ;my $a = fred->[0] ;EXPECTCan't use bareword ("fred") as an ARRAY ref while "strict refs" in use at - line 4.######### strict refs - erroruse strict 'refs' ;my $a = fred->{barney} ;EXPECTCan't use bareword ("fred") as a HASH ref while "strict refs" in use at - line 4.######### strict refs - no erroruse strict ;no strict 'refs' ;my $fred ;my $b = "fred" ;my $a = $$b ;use strict 'refs' ;EXPECT######### strict refs - no erroruse strict qw(subs vars) ;my $fred ;my $b = "fred" ;my $a = $$b ;use strict 'refs' ;EXPECT######### strict refs - no errormy $fred ;my $b = "fred" ;my $a = $$b ;use strict 'refs' ;EXPECT######### strict refs - no erroruse strict 'refs' ;my $fred ;my $b = \$fred ;my $a = $$b ;EXPECT######### Check runtime scope of strict refs pragmause strict 'refs';my $fred ;my $b = "fred" ;{    no strict ;    my $a = $$b ;}my $a = $$b ;EXPECTCan't use string ("fred") as a SCALAR ref while "strict refs" in use at - line 10.######### Check runtime scope of strict refs pragmano strict ;my $fred ;my $b = "fred" ;{    use strict 'refs' ;    my $a = $$b ;}my $a = $$b ;EXPECTCan't use string ("fred") as a SCALAR ref while "strict refs" in use at - line 8.######### Check runtime scope of strict refs pragmano strict ;my $fred ;my $b = "fred" ;{    use strict 'refs' ;    $a = sub { my $c = $$b ; }}&$a ;EXPECTCan't use string ("fred") as a SCALAR ref while "strict refs" in use at - line 8.########--FILE-- abcmy $a = ${"Fred"} ;1;--FILE-- use strict 'refs' ;require "./abc";EXPECT########--FILE-- abcuse strict 'refs' ;1;--FILE-- require "./abc";my $a = ${"Fred"} ;EXPECT########--FILE-- abcuse strict 'refs' ;my $a = ${"Fred"} ;1;--FILE-- ${"Fred"} ;require "./abc";EXPECTCan't use string ("Fred") as a SCALAR ref while "strict refs" in use at ./abc line 2.Compilation failed in require at - line 2.########--FILE-- abc.pmuse strict 'refs' ;my $a = ${"Fred"} ;1;--FILE-- my $a = ${"Fred"} ;use abc;EXPECTCan't use string ("Fred") as a SCALAR ref while "strict refs" in use at abc.pm line 2.Compilation failed in require at - line 2.BEGIN failed--compilation aborted at - line 2.######### Check scope of pragma with evalno strict ;eval {    my $a = ${"Fred"} ;};print STDERR $@ ;my $a = ${"Fred"} ;EXPECT######### Check scope of pragma with evalno strict ;eval {    use strict 'refs' ;    my $a = ${"Fred"} ;};print STDERR $@ ;my $a = ${"Fred"} ;EXPECTCan't use string ("Fred") as a SCALAR ref while "strict refs" in use at - line 6.######### Check scope of pragma with evaluse strict 'refs' ;eval {    my $a = ${"Fred"} ;};print STDERR $@ ;EXPECTCan't use string ("Fred") as a SCALAR ref while "strict refs" in use at - line 5.######### Check scope of pragma with evaluse strict 'refs' ;eval {    no strict ;    my $a = ${"Fred"} ;};print STDERR $@ ;my $a = ${"Fred"} ;EXPECTCan't use string ("Fred") as a SCALAR ref while "strict refs" in use at - line 9.######### Check scope of pragma with evalno strict ;eval '    my $a = ${"Fred"} ;'; print STDERR $@ ;my $a = ${"Fred"} ;EXPECT######### Check scope of pragma with evalno strict ;eval q[     use strict 'refs' ;    my $a = ${"Fred"} ;]; print STDERR $@;EXPECTCan't use string ("Fred") as a SCALAR ref while "strict refs" in use at (eval 1) line 3.######### Check scope of pragma with evaluse strict 'refs' ;eval '    my $a = ${"Fred"} ;'; print STDERR $@ ;EXPECTCan't use string ("Fred") as a SCALAR ref while "strict refs" in use at (eval 1) line 2.######### Check scope of pragma with evaluse strict 'refs' ;eval '    no strict ;    my $a = ${"Fred"} ;'; print STDERR $@;my $a = ${"Fred"} ;EXPECTCan't use string ("Fred") as a SCALAR ref while "strict refs" in use at - line 8.######### [perl #26910] hints not propagated into (?{...})use strict 'refs';/(?{${"foo"}++})/;EXPECTCan't use string ("foo") as a SCALAR ref while "strict refs" in use at (re_eval 1) line 1.######### [perl #37886] strict 'refs' doesn't apply inside defineduse strict 'refs';my $x = "foo";defined $$x;EXPECTCan't use string ("foo") as a SCALAR ref while "strict refs" in use at - line 4.######### [perl #37886] strict 'refs' doesn't apply inside defineduse strict 'refs';my $x = "foo";defined @$x;EXPECTCan't use string ("foo") as an ARRAY ref while "strict refs" in use at - line 4.######### [perl #37886] strict 'refs' doesn't apply inside defineduse strict 'refs';my $x = "foo";defined %$x;EXPECTCan't use string ("foo") as a HASH ref while "strict refs" in use at - line 4.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -