Wednesday, 21 April 2010

It's been a while

It has been a while since I last blogged. Unfortunately, family health problems are still not in a resolved state, so it probably will be so again.

However, last week, I went on Dave Cross's advanced perl course/seminar. In fact, most of my team did.

Dave knew his stuff (and apologised that he was talking about the 'new' 5.10 when 5.12 was released less than 36 hours earlier).

The course was interesting, however, due to the limitations of time (1 day isn't long enough, and I do like Lab-time) we didn't cover as much about Moose/DBIx::Class/Catalyst than I would have liked.

However, he did cover Test::Builder, which I hadn't really seen before, and how to create your own bespoke tests which will fit in with the plan.

And so I just have.

I have released Test::Structures::Data today. At the moment it only exposes one method

is_value_found_in_hash_values

Now, this is not to detract from Test::Deeply (which I like a lot!) or Test::Data::Hash, however, I could not find any methods which go to see if a value is present in a data structure, and this was particularly what I was after.

It is on CPAN

http://tinyurl.com/y5owods

and my github repository is

http://github.com/setitesuk/Test--Data--Structures

I plan to add some other methods shortly. These are meant to be simple things though. For example, you may have a hash, and a value. You don't know which key the value should be for, or even care which key it belongs to. The above test just sees if it can find it in the hash values.

Hoping this might be of use to someone (anyone?)

Andy

5 comments:

David Precious said...

Out of interest, is there a reason you wouldn't just use something like:

ok(
grep { $_ eq $foo } values %hash,
"Hash contains value $foo"
);

?

Just seems a trivially-simple thing to do without requiring a separate module, to me.

It looks like you plan to add more similar tests to your module though, so it might still make sense.

Also, I think personally I'd go for something a little more terse, like hash_contains_value() rather than is_value_found_in_hash_values().

紅豆 said...

IS VERY GOOD..............................

Joshua Smith said...

Thanks for your help in describing this. Great review! Also turn your attention that it needs to search for mobile software development companies if you need mobile software development.

Joshua Smith said...

Thanks for nice info. Let me mention about homeowners insurance by zip code with discounts homeowners protection companies. Compare free rates on homeowners insurance.

Joshua Smith said...

Thank you for posting this great info. You have nice possibility to clarify casino affiliate program. The best gaming programs such as ace live and great poker rooms such as redbet.