开发者

Is there a way to determine exactly what operator a Perl B::LOGOP object refers to?

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜