perl - Question about compile-time-errors -
#!/usr/bin/env perl use warnings; use 5.012; "no semicolon" "world"; "world"; "world"; "world"; "world"; # syntax error @ ./perl1.pl line 7, near "say" # execution of ./perl1.pl aborted due compilation errors.
.
#!/usr/bin/env perl use warnings; use 5.012; $character = "\x{ffff}"; "hello"; "hello"; "hello"; "hello"; "hello"; # unicode non-character 0xffff illegal interchange @ ./perl1.pl line 5. # hello # hello # hello # hello # hello
why doesn't second script tell me, there compile-time-error?
when can't - "use warnings fatal => qw(all);" - catch error try::tiny or block-eval, can conclude, compile-time-error?
#!/usr/bin/env perl use warnings fatal => qw(all); use 5.012; use try::tiny; $character; try { $character = "\x{ffff}"; } catch { die "---------- caught error ----------\n"; }; "something"; # unicode non-character 0xffff illegal interchange @ ./perl1.pl line 9.
unicode non-character 0xffff illegal interchange @ ...
compile time warning.
when use warnings fatal => all
, asking perl treat warnings errors, hence becomes compile time error.
Comments
Post a Comment