[SP-pm] Embalão [Was: S.O.S]
Igor Sutton Lopes
igor.sutton em gmail.com
Quinta Maio 10 14:06:50 PDT 2007
On May 10, 2007, at 5:37 PM, Solli Honorio wrote:
>
> elvis:~ igorsutton$ perl -MO=Deparse -we '$dir = q{.}; opendir my
> $file, $dir'
> BEGIN { $^W = 1; }
> $dir = '.';
> opendir my $file, $dir;
> -e syntax OK
>
> Seria porque neste caso o compilador está declarando e utilizando a
> variável $file, e utilizando a variável já declarada....
>
> elvis:~ igorsutton$ perl -MO=Deparse -we '$dir = q{.}; opendir my
> $file, $dir;'
> Parentheses missing around "my" list at -e line 1.
> BEGIN { $^W = 1; }
> $dir = '.';
> opendir my $file, $dir;
> -e syntax OK
>
> ... e aqui o cara esta achando que você quer declarar as variáveis
> $file e $dir.
>
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 ;-)
--
Igor Sutton
igor.sutton em gmail.com
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: http://mail.pm.org/pipermail/saopaulo-pm/attachments/20070510/73a0e12e/attachment-0004.html
-------------- Próxima Parte ----------
Um anexo não texto foi limpo...
Nome : PGP.sig
Tipo : application/pgp-signature
Tam : 186 bytes
Descr.: This is a digitally signed message part
Url : http://mail.pm.org/pipermail/saopaulo-pm/attachments/20070510/73a0e12e/attachment-0004.bin
Mais detalhes sobre a lista de discussão SaoPaulo-pm