Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: how to avoid mis-spelling hash keys?

by aspen (Sexton)
on Jan 05, 2003 at 20:24 UTC ( #224463=note: print w/replies, xml ) Need Help??


in reply to how to avoid mis-spelling hash keys?

There are a couple of other modules that perform related functionality, that is validating hash keys but also performing additional hash-access checks:
Tie::StrictHash
Provides key checking for references but provides functionality to ensure you don't unintentionally create a new key. Also controls clearing of the Hash.

Feedback: Strongly-typed "Pascal records" module
This was a module I just recently posted. It's purpose was to prevent exactly those types of finger-fault errors, but it goes farther in that it allows Perl to ensure you assign the type of data you intended to any particular Hash key. That catches errors such as assigning: $hash{product_list}=$a_product; When what you really meant was: $hash{product_list}=[$a_product];.

Andy

@_="the journeyman larry disciple keeps learning\n"=~/(.)/gs, print(map$_[$_-77],unpack(q=c*=,q@QSdM[]uRMNV^[ni_\[N]eki^y@))

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://224463]
help
Chatterbox?
[Corion]: Hmmm. I feel a Meditation coming on. I wrote a module, DBIx::PivotQuery, which returns a table-like set of rows (AoA) but some columns are generated from column values, like in an (Excel) pivot table or a ROLLUP command
[Corion]: My current approach for subtotals involves rerunning the given query, with the hint to the user that they should use a temporary table if they want better performance.
[Corion]: But I could create that temporary table in the module and use it for the improved perfomance directly instead.
[Corion]: And the question is, what would be better/preferred ;-)
[Corion]: Hmm - not exactly like the ROLLUP command. Ah well.

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2017-02-23 15:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (347 votes). Check out past polls.