Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Test::Deep regex on hash keys

by Zoffix (Acolyte)
on Dec 26, 2013 at 09:44 UTC ( #1068407=note: print w/replies, xml ) Need Help??


in reply to [SOLVED] Test::Deep regex on hash keys

I actually just solved when I peeked at the Test::Deep's code. There's an undocumented hash_each() subroutine, so the code becomes:
{ 'markets' => hash_each( { 'primaryname' => re('.'), 'volume' => re('^[-+.\d]+$'), 'lasttradeprice' => re('^[-+.\d]+$'), 'marketid' => re('^\d+$'), 'secondarycode' => re('.'), 'primarycode' => re('.'), 'lasttradetime' => re('.'), 'label' => re('.'), 'secondaryname' => re('.'), 'buyorders' => array_each( { 'quantity' => re('^[-+.\d]+$'), 'price' => re('^[-+.\d]+$'), 'total' => re('^[-+.\d]+$'), }, ), 'sellorders' => array_each( { 'quantity' => re('^[-+.\d]+$'), 'price' => re('^[-+.\d]+$'), 'total' => re('^[-+.\d]+$'), }, ), 'recenttrades' => array_each( { 'quantity' => re('^[-+.\d]+$'), 'price' => re('^[-+.\d]+$'), 'total' => re('^[-+.\d]+$'), 'id' => re('.'), 'time' => re('.'), }, ), }, ), }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (9)
As of 2019-10-17 12:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?