Today I am just going to carry on with a few 'xt' tests in my '25_exe_array.t' test case. Now I started out wanting to do an update with the execute array so I came up with this test;
$da->reset_conditions();
my $update_people = $people->update_people_data();
my $updated_people = $people->updated_people_data();
ok($da->update($dbh,$update_people),"Update Four New Users ");
ok($da->result()->effected == 4,"Four row effected");
Fortunately before I ran this I realized that the above is not going to do what I expect it to do. I think it will just update all the rows in the db four times each wilt an sql like this;
"A lot has been written about parsing left recursion. Unfortunately, much of it simply adds to the mystery. In this post, I hope to frame the subject clearly and briefly."
How can we use long lists of symbols from an imported package and still keep the code readable?
I usually prefer use statements of the form:
use My::Module qw(symbol1 symbol2 symbol3);
Except for specially understood modules, like Moose and Test::More, I don't like to just import everything. Rather I like to explicitly call out only the specific symbols I need.
But what if you need to:
use My::Module qw(
symbol1 symbol2 symbol3 symbol4 symbol5 etc and so many symbols
that it takes up several lines all the time in every package
that uses it
);
With upcoming version 0.2.0 swat removes usage of prove as internal test runner. There are some -minor- breaking changes due to this. For those who uses swat I would recommend to read GH pages docs and in case you'll need help with migration of your project to the latest swat version don't hesitate to contact me.
Back into extended test mode here in the Moose-Pen;
Time to get back to some more practical tests as I have been side tracked by a few API issues. Just to re-cap the practical tests are found in the 'xt' dir and I am using them to test Driver::DBI against a real DB. So far this practical testing has sniffed out a whole lot of bugs and I am hoping to sniff out a few more.
Today I am am going to play with the DBIs 'execute array' this should be totally transparent to the end user all I need to do is pass an 'Array-ref' into my $da as the container and DBI::Driver should do the rest.
If I were to pick the most ubiquitous construct in the Perl 6 programming
language, it'd most definitely be the colonpair. Hash constructors,
named arguments and parameters, adverbs, and regex modifiers—all involve the
colonpair. It's not surprising that with such breadth there would be many
shortcuts when it comes to constructing colonpairs.
Today, we'll learn about all of those! Doing so will have us looking at the simplest as well as some of the more advanced language constructs, so if
parts of this article make you scratch your head, don't worry—you don't
have to learn all of it at once!
PART I: Creation
Colonwhaaaa?
The colonpair gets its name from (usually) being a Pair object constructor
and (usually) having a colon in it. Here are some examples of colonpairs:
Being lazy, I thought to myself, "when using the web interface, why should I need to add my country to the query?". So, using CGI::Lingua which is already available via the VWF system used to build the site, you longer need to do that. From the US, try this:
It has been a long running battle between myself,m the API and the the 'Link' objects. A number of posts over the past few weeks have been dealing with how to handle the 'view' for the various elements on link.
Today I started down the path of enforcing the API rule that all 'elements' in a link must have a view. So given this link;
Unit tests are great. They show that the code was actually designed
to a given spec.
Runtimeassertions
are great. They show that the code is actually running the way it
was designed when applied to real data.
Design by contract is
a great concept, but it's a bit of an overkill for most projects.
However, sometimes I feel an urge to just rip several lines from a unit
test and put them right into production code. Test::More
doesn't help here much since my application isn't really meant to
output TAP or run in a
harness.
If you follow the updates on KickStarter, you may know the Learning Perl 6 book is nearing completion, with the author planning to submit final manuscript to O'Reilly on
June 18th.
What this means is the July's Rakudo Star release will possibly be the release the first crop of readers of that book will be using (the next release after that is in October). I've seen several people say they're waiting for this book to get
published before they give Perl 6 a try. Coupled with the marketing the author
and O'Reilly will be doing for the book, I expect to see an influx of new
users.
For that reason, I'm making a call to action, for everyone to polish the
experience of the first steps those users will make in Perl 6.
How to Help?
There are several things you can help with, depending on your skillset. And
before anyone protests, don't worry, there's one thing everyone is able to
do…
There are still a few little things to clean up before I move away from record-sets. The first issue I think would be when I have asked for a 'Class' with 'da_result_set' but I have not supplied a 'da_result_class'.
In my Driver::DIB code I did add in this;
if ($self->is_Class() and $self->da_result_class()){
where it checks to ensure the class is present but I think in the way I am designing the API I should die well before this as I do in a number of other similar situations.
So to accomplish the above I will first write up a test in good old '20_dad_load.t'
I'm keen to work on more "intuitive" searches for Geo::Coder::Free. It occurred to me, for example, when looking for a local favourite watering hole of mine, that I wouldn't be likely to search for "Rock Bottom Restaurant, Norfolk Ave, Bethesda, MD, USA". Instead, I'd be much more likely to search for "Rock Bottom, Bethesda, MD, USA'.
So I've added support for that. As a proof of concept, I only work on Restaurants, however the Whos On First data includes a (admittedly unsupported field) of sg:classifier which I should be able to use for a more wide support. What that means is that is if a business type is included in the name of the business, I can remove it and anything after that and add it to the database. In simple terms that allows "Foo Hairdressers and Barber's shop" to be indexed as "Foo". And because you don't always know the street name, it's indexed both with and without.
I'm sure there will be plenty of cases were the above scenario doesn't work - I'll monitor Apache logs - but as a start it works surprisingly well, as shown by
Yesterday, I described how I had approached developing PearlBee by reworking the data models and writing tests. That worked fine until a point, where the pipeline of user interaction was fairly obvious.
For example, it’s easy to write tests for a “reset password” feature. The user is supposed to go to the login page, see a link to reset password, click that. They should then submit their email or username in a form, and get an email with a link to a reset password form. All pretty obvious, since we’ve all used that several times (at least until password managers became popular :) ).
When I moved into the admin section of the website, though, it became a lot more subjective how it was supposed to look like. Not even from a design perspective – from a test perspective. What am I actually testing for?
It is me, or is it internet? When you are organizing events, people respond later and later every year. You buy a book on internet, and it is delivered next day. The washing machine dies, but you do not have to leave the house anymore. But meeting organizers can not deliver in a single day.
We need to see each other every once in a while. For me a must; meeting weird Perl people challenges my own ideas. I get so enthusiastic seeing the projects which other people undertake. It gives me energy to work on my own plans. To meet people for Perl, I visit the monthly meetings of the Amsterdam Perl Mongers (great!), all European Perl Conferences, and often the German Perl Workshops. Very cosy events, where I see my traveling family.
Well, in NL we also organize our own yearly Workshop. The best place to meet "local" Perl addicts. Melinda (Damnlie) and me (MarkOv) warmly invite you all. Read more at http://perlworkshop.nl
The bonus deliverable "Perl 6 Numerics" Language documentation page was
merged to master. It describes all of the available Perl 6 numerics, their
interactions, suitability, and hierarchy.
The newest post on the "Ocean of Awareness" blog is
"Marpa and procedural parsing"
: Marpa's procedural parsing is more flexible and more powerful than recursive descent's.
About a year ago, I submitted a grant proposal to TPF to revitalize this platform, blogs.perl.org. It was supposed to have taken only a few months, but it's still not ready. In the meantime, I have been completely silent, at least publicly. What's going on? Is it ever going to be delivered?
Indeed, I should have started writing here months ago, with traditional timely updates on the developments on the grant. What discouraged me to do so was that these developments have been somewhat irregular. Some moments of uncertainty on the best course of action, and others of simply not being able to dedicate enough time to it. Still, I assure you, dear BPO reader, the project is alive and well!
In the interest of being more open, then, I'll make a series of posts this week saying all that I've been working on and what's my overall plan for blogs.perl.org and PearlBee.