[SP-pm] Embalão [Was: S.O.S]
"Iberê O. Kuntz de Souza"
kuntzzz em gmail.com
Quinta Maio 10 16:29:38 PDT 2007
> Acredito que seja um problema no warnings.pm mesmo, como o Wendel falou antes. Veja a árvore de operações gerada pelo Perl nas duas situações:
>
> elvis:~ igorsutton$ perl -MO=Terse -we '$dir = q{.}; opendir my $file, $dir;'
> Parentheses missing around "my" list at -e line 1.
> LISTOP (0x404a80) leave [1]
> OP (0x401170) enter
> COP (0x404a40) nextstate
> BINOP (0x404a20) sassign
> SVOP (0x405130) const PV (0x1800ec8) "."
> UNOP (0x4050c0) null [15]
> SVOP (0x404a00) gvsv GV (0x1800f40) *dir
> COP (0x404b60) nextstate
> LISTOP (0x4050e0) open_dir
> OP (0x404b20) null [3]
> UNOP (0x404b40) rv2gv [2]
> OP (0x404aa0) padsv [1]
> UNOP (0x405110) null [15]
> SVOP (0x404ac0) gvsv GV (0x1800f40) *dir
> -e syntax OK
>
> elvis:~ igorsutton$ perl -MO=Terse -we '$dir = q{.}; opendir my $file, $dir'
> LISTOP (0x404a80) leave [1]
> OP (0x404b00) enter
> COP (0x404a40) nextstate
> BINOP (0x404a20) sassign
> SVOP (0x405130) const PV (0x1800ec8) "."
> UNOP (0x4050c0) null [15]
> SVOP (0x404a00) gvsv GV (0x1800f40) *dir
> COP (0x404ac0) nextstate
> LISTOP (0x401170) open_dir
> OP (0x401190) null [3]
> UNOP (0x4011b0) rv2gv [2]
> OP (0x404aa0) padsv [1]
> UNOP (0x405100) null [15]
> SVOP (0x4050e0) gvsv GV (0x1800f40) *dir
> -e syntax OK
>
> No arquivo 'op.c' (perl 5.9.5 DEVEL30932):
>
> 2274 while (1) {
> 2275 if (*s && strchr("@$%*", *s) && *++s
> 2276 && (isALNUM(*s) || UTF8_IS_CONTINUED(*s))) {
> 2277 s++;
> 2278 sigil = TRUE;
> 2279 while (*s && (isALNUM(*s) || UTF8_IS_CONTINUED(*s)))
> 2280 s++;
> 2281 while (*s && (strchr(", \t\n", *s)))
> 2282 s++;
> 2283 }
> 2284 else
> 2285 break;
> 2286 }
> 2287 if (sigil && (*s == ';' || *s == '=')) {
> 2288 Perl_warner(aTHX_ packWARN(WARN_PARENTHESIS),
> 2289 "Parentheses missing around \"%s\" list",
> 2290 lex ? (PL_in_my == KEY_our ? "our" : PL_in_my == KEY_state ? "state" : "my")
> 2291 : "local");
> 2292 }
> 2293 }
>
> O erro, pelo que eu entendi, acontece quando têm C<;> por que o resultado da linha 2287 C<(*s == ';' || *s == '=')> devolve verdadeiro e entra no erro, caso contrário, não.
>
> Boa sorte ;-)
É mesmo neh.. um pequeno bug, no perl6 isso sera corrigido :)
Mais detalhes sobre a lista de discussão SaoPaulo-pm