Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^5: hash keys and regex

by Aristotle (Chancellor)
on Dec 25, 2004 at 02:55 UTC ( [id://417379]=note: print w/replies, xml ) Need Help??


in reply to Re^4: hash keys and regex
in thread hash keys and regex

Well, first of all, all that's necessary is the @tier array and the code generating the regex. All the rest is plumbing which I dropped in there to make sure that the regex does indeed do what it's supposed to do.

There's no Test::Block module on my machine. plan() is a function of Test::More which takes the number of tests that will be run — since I use key in scalar context (forced by the + 0), it returns the number of keys in the hash, which is the number of tests I'll be running. The %testcase hash is makes adding tests easier, and of course, if I want to test whether the regex works correctly, then I must decide ahead of time what result it is supposed to produce.

But again, nothing besides the @tier array and the code generating the regex is necessary. I just added all of the testing bits because that code wasn't easy to get right immediately, so I wanted to make sure it behaves as it is supposed to.

Makeshifts last the longest.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-04-25 20:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found