Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: non-autovivifing hash

by toma (Vicar)
on Jul 03, 2003 at 00:32 UTC ( #271025=note: print w/replies, xml ) Need Help??

in reply to non-autovivifing hash

I agree that it would be nice to have more level of control over autovivification. As tye suggests, sometimes only one level of autovivification is desired. Someone else might want at most two levels, such as when working with 2D arrays.

A debugger could be enhanced with an object that could provide this level of checking. This debugging object would contain a pointer to a variable whose autovivification is being monitored. Perl's debugger hooks could check autovivification constraints on a line-by-line basis at run-time. After the program starts working, the run-time checking could easily be turned off.

This is the sort of problem that I have trouble debugging with print statements, but I can easily debug with the ptkdb debugger. I just put the hash in the watch variable window and see how it grows. Or, if the data structure being monitored is too large, I put something like scalar(keys %myhash) in the watch window.

I've already been flamed each time that I have mentioned debuggers, so maybe we can skip that part this time!

It should work perfectly the first time! - toma

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://271025]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2023-12-08 15:32 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (36 votes). Check out past polls.