From playing with B, I see that a B:开发者_StackOverflow社区:LOGOP
object (call it "$op
") referring to either a &&
or and
operator will both return "and" upon calling $op->name
. Is it possible to determine which operator the LOGOP refers to merely by examining $op
?
I am not expert for perl internals, but LOGOP
refers to logical operator group. So I don't think you can know individual operator without examining the name. Even B::Terse displays it:
perl -MO=Terse -e '$a && $b'
Shows:
....
LOGOP (0x198ad94) and
UNOP (0x198adec) null [15]
PADOP (0x198ae08) gvsv GV (0x187bb9c) *a
UNOP (0x198adb4) null [15]
PADOP (0x198add0) gvsv GV (0x187bc9c) *b
精彩评论