Subject: | 'identify' output misleading about shared lexical captures |
This example output
Show quoted text
pmat> identify 0x72a7140
ARRAY(457025) at 0x72a7140 is:
└─(via RV) value {error} of HASH(3) at 0x490ea40, which is:
└─(via RV) value {events} of HASH(8)=Mojo::Redis2 at 0x490e0b0, which is:
└─(via RV) value {ws_redis_master} of HASH(4) at 0x3ebef40, which is:
├─(via RV) the lexical $instances at depth 1 of CODE(PP) at 0x4264c38, which is:
│ └─the symbol '&Binary::WebSocketAPI::v3::Wrapper::Streamer::shared_redis'
├─(via RV) the lexical $instances at depth 1 of CODE(PP) at 0x42504a0, which is:
│ └─the symbol '&Binary::WebSocketAPI::v3::Instance::Redis::instances'
├─(via RV) the lexical $instances at depth 1 of CODE(PP) at 0x4257500, which is:
│ └─the symbol '&Binary::WebSocketAPI::v3::Instance::Redis::redis_pricer'
├─(via RV) the lexical $instances at depth 1 of CODE(PP) at 0x4264920, which is:
│ └─the symbol '&Binary::WebSocketAPI::Plugins::Helpers::ws_redis_slave'
└─(via RV) the lexical $instances at depth 1 of CODE(PP) at 0x4263eb8, which is:
└─the symbol '&Binary::WebSocketAPI::Plugins::Helpers::ws_redis_master'
is misleading because it mentions "the lexical $instances" multiple times. In actual fact, the same lexical variable is shared among the various functions. The output ought probably look something more like
Show quoted text pmat> identify 0x72a7140
ARRAY(457025) at 0x72a7140 is:
└─(via RV) value {error} of HASH(3) at 0x490ea40, which is:
└─(via RV) value {events} of HASH(8)=Mojo::Redis2 at 0x490e0b0, which is:
└─(via RV) value {ws_redis_master} of HASH(4) at 0x3ebef40, which is:
└─(via RV) the lexical $instances which is captured:
├─at depth 1 of CODE(PP) at 0x4264c38, which is:
│ └─the symbol '&Binary::WebSocketAPI::v3::Wrapper::Streamer::shared_redis'
├─at depth 1 of CODE(PP) at 0x42504a0, which is:
│ └─the symbol '&Binary::WebSocketAPI::v3::Instance::Redis::instances'
├─at depth 1 of CODE(PP) at 0x4257500, which is:
│ └─the symbol '&Binary::WebSocketAPI::v3::Instance::Redis::redis_pricer'
├─at depth 1 of CODE(PP) at 0x4264920, which is:
│ └─the symbol '&Binary::WebSocketAPI::Plugins::Helpers::ws_redis_slave'
└─at depth 1 of CODE(PP) at 0x4263eb8, which is:
└─the symbol '&Binary::WebSocketAPI::Plugins::Helpers::ws_redis_master'
--
Paul Evans