A Dozen is one of those great numbers that goes way back to the Assyrian empire so today was just a little writing up what I though would be my last .t for my new MooseX and then put this project to bed by throwing it up on CPAN. I was wrong.
Well it seems I have a little bug in my .t files. I was happily doing today's .t and about half way though I ran into this
I think this was a great suggestion of Yanick because it provides an opportunity to introduce a Perl developer a week without too much work.
GitTip is great. It provides a very easy way to people to give a little weekly reminder to someone, that their work is appreciated. Without even the need to talk to that person...
It you are listed in the GitTip Perl community, and/or on the CPAN Tip mashup, it would be great if you could add a few more words about yourself to your GitTip profile. E.g. a link to your MetaCPAN profile. A link to your blog.
Math::Prime::Util, and the optional Math::Prime::Util::GMP back end, are a set of modules for number theory in Perl, with a large overlap of functionality with PARI/GP. This is an update on some of the things that were new in the April release (0.40 of MPU, 0.19 of MPU::GMP).
The usual speed improvements in various areas, some approximation improvements, and new functions. Primality testing benchmarks also show Perl has state of the art solutions.
Well still milking this one for all its worth and today I will do another .t file.
This time round I am going to test the API validation. You might remember that I did add a little validation code and this is one that really should be tested. Many is the time where a lovely API has been created but no validation so one was able to enter all sorts of nu-sanitized data and commands against the API.
So in my little API I want to check for at least one of my API keys and that if a key is present it points to an Array-Ref.
So here is what I came up with again very simple which I always find best
Looking at the list of REST Interfaces listed on Mongo's site, there isn't a Perl solution. Well this just won't stand. So after looking at the python program to see if I missed something about what this would entail, I hacked out this gist.
After languishing in a dark eddy for several years since it was spun out of Template Toolkit core, I have adopted the Template::Plugin::Autoformat module and just released version 2.75 to CPAN.
The biggest change is how you USE it in your templates. The new version switches to initial cap 'Autoformat' instead of the previous lowercase 'autoformat'. This switch follows the Plugin convention used elsewhere, and fixes the long-standing bug where case-sensitive file systems failed to find the .pm file. (And shouldn't all filesystems be case-sensitive? I'm looking at you, HFS.)
mop can't weaken attribute variable from outside. mop have weaken feature, but this is defined in only class and this work only when value is set. We can't weaken attribute from outside. This is not useful and some problems will occur.
# Hash base object
my $point = Point->new;
my $foo = {bar => 1};
$point->foo($foo);
weaken $point->{foo};
# mop
# We can't weaken attribute variable from outside of object.
Perl garbage collection is reference-count type. This mean if objects is referenced each other(A -> B -> A) or circle(A -> B -> C ->A), object is not released. so we should be able to weaken any object freely.
Well back on the Moose path again and today a little post on my next test for my first little Moosex. Like I said in my last post I like my tests to be simple and functional.
I did have look at the test suite for MooseX-AuthorizedMethods and for me it was a little too Mooseish fro my tastes, I guess he was very keen on testing to see if bits of Moose worked rather than focusing on the functionality of the modual. For example I did not see test of using a Custom Verifiers at least one that I could figure out. Like I said in a previous post, one of those would been nice.
So lets just stick with the basic functionality no need I think to get into all the Moose side of stuff with the meta etc.
Welcome to Planet Moose, a brief write up on what's been happening in the world of Moose in the past month, for the benefit of those of you who don't have their eyes permanently glued to the #moose IRC channel, or the MetaCPAN recent uploads page.
Apologies for being a little late delivering the news this month. If you'd like to contribute some news for next month's issue, you can do so on the wiki.
Moose
Version 2.1205 is a minor update containing a small bug fix and an improved test case. One interesting new addition is the is_role function in Moose::Util.
Are you a lone Web developer who has a great idea for an app but you're intimidated by the idea of getting a Web server, maintaining the OS, installing the database, handling DNS, keeping up to date with security patches and so on? Instead, you can try a Platform as a Service (PaaS) system and let them handle the system administration stuff while you focus on just writing your code.
well not that bad just a little frustrating and not very productive for about 3 hours of time.
Was playing about with Test-WWW-Selenium and going at it great guns after about a four year absence since I had to use Test::WWW::Mechanize in the last place I worked that was doing a little testing, Needless to say I was just a little rusty in my Selenium skills and I didn't have my code base from when I used it last but I was glad to see one can get the Selenium server running headless on ubuntu.
So I get into the programming swing of things and the I get stuck. I have to test all the links on a page to make sure there are no bad ones. So easy I remeber how to do that just
A year and a bit ago I wrote about measuring the coverage not of the code I was testing but of my tests, and how doing so had helped me find some problems. Today I dived further down that rabbit-hole.
As I mentioned then, we ran all our tests under Jenkins. Because we're testing quite a complex application, which needs configuration data, databases and so on, we've got a wrapper script that sets up all that jibber-jabber, runs the tests, and then tears down the temporary databases and stuff that it created. But that script had a bug. Under some circumstances, if one of the test scripts failed, the wrapper script would eventually exit with status 0, which is the Unix-ism for "everything went as expected", and so Jenkins would say "all the tests passed, hurrah". We need it to exit with a non-zero status if anything went wrong so that Jenkins will know that it needs to kick up a fuss.
A while ago I was playing around with Win32API::ProcessStatus which provides an interface to psapi.dll on Windows. It had an undeclared dependency on Win32API::Process and needed just a minor correction to get it working on cygwin, so I emailed the author on February 6, 2014 with the changes and offered to adopt the module if he didn't have the time or interest in maintaining the module for himself.
As per advice from the CPAN FAQ I am posting my interest in adopting this module, in case anyone including the original author has any concerns.
Well reaching the end of the road here now that I did my code review I think it is now about time I sit down and write up my first .t files for my Moosex.
I always think it is best to keep your tests simple and small, but not too small so I usually use Test::More as that give me just a few dependencies but a good load of extras. I am also little old school with my testing style as I like the good old numbered and named test that cover only one part of functionality.
So to start off I am going to start with good old 00-load.t
#!perl -T
use Test::More tests => 1;
use_ok('MooseX::AuthorizedMethodRoles');
Today i tried to rebase my dev branch of OpenGL.pm on the latest changes and found that a segfault in OpenGL::Array was assumed to be fixed, despite still being alive and well. With nothing (haha) better to do i decided to poke at it and see if i could fix it. I foregrounded #xs on irc.perl.org in my IRC client and set to work. My first stumbling block came surprisingly soon:
How to print debug messages in XS?
Since i can't just step through XS in the perl debugger, i had to debug via printing to the command line. However the XS in OpenGL.pm seems to swallow all output to STDOUT. Leont suggested it might be the test harness, but at that point i wasn't even running in a test harness. Even with bulk88 weighing in nobody actually knows why it does that, however the solution was fairly easy:
In XS croak() and warn() are provided and even work akin to printf.