Well if carry on as if you are normal day here in the Moose-pen
In yesterday's post I manged to get the update sub working with a real DB and today I am going to try the 'retrieve' sub which is a little more tricky.
The basic concept is much the same as for the other two and it really did not take me long to get it up and working, the only real gaff was this one
Subroutine _select redefined at
as I had a stubbed in version that I simply got rid of. Apart from that and the sact one does not spell alias as alais things when together quickly and here is what I have;
Unfortunately, the regular expression part of the above FAQ page is wrong. \d doesn't validate numbers, unless you have already verified that your input contains only ASCII characters.
What \d does is to validate whether a number is regarded as a numeral in Unicode. For example, \d will happily match things like U+07C2: '߂' NKO DIGIT TWO, or 096F: '९' DEVANAGARI DIGIT NINE, and 360 other characters which are not valid as numerals. If you need to use a regular expression to validate whether something is a number, use [0-9] to match digits, not \d.
The reason I'm aware of these defects in the use of \d for validating numbers is because of having used it to validate user input at the following web pages:
The Type::Tiny 1.1 (1.001_00x) development cycle has been going on since September 2014. Apparently I'm either very concerned about stability or very lazy. You can make up your own minds about that.
But Type::Tiny 1.2 should be released in a few weeks. If your application uses Type::Tiny, you may want to download the latest development release and check that nothing breaks. (It shouldn't, but you never know until you try.)
The headline changes are:
Type::Params now has compile_named and validate_named.
Type::Tiny's constraint parameter may be a string of code.
Fixed bug where Types::Standard::Int would sometimes accept an overloaded object. (It never should.)
Various performance enhancements and bug fixes.
I'll explain the first two in more detail, because they're interesting.
Now that I have got 'create/insert' to work in yesterday's post I think I will move on down the line and get the next one easy one to work 'update'.
This first thing though is to get rig of this waring;
Commit ineffective while AutoCommit is on-1 at D:\GitHub\database-accessor-driver-dbi\lib/Database/Accessor/Driver/DBI.pm line 64
ok 1 - Create function
nothing major really the waring is perfectly harmless but I could see some people getting annoyed at that and the fix is simple, if the DBI 'AutoCommit' flag is set don't try and commit. So here is that change;
$dbh->commit()
-- unless($self->da_no_effect);
++ if ($dbh->{AutoCommit} == 0 and !$self->da_no_effect);
Perl in a Business Application - Musings of an Architect
Everybody knows that Perl is not the right language for a large scale
enterprise application. This is common knowledge, right?
But why is that? Explanations are as many as there are people explaining.
Everything from "it's a script language, therefore slow" to
"its free syntax breeds discoherence" to
"Perl developers are horrible individualists".
Well, I didn't believe this, and I went on to help in a startup which wants
to build some fintech systems, the first aim of which is to integrate with
Finnish banks and collect daily payments from a customer's bank account.
It was decided to use Perl as the core language. If Perl is (was) good enough
for Goldman Sachs and Morgan Stanley it surely is good enough for us.
So off to build a framework!
The Lab::Measurement project provides Open Source control of test & measurement devices with Perl. On our recent poster, which was presented at this year's DPG Spring Meeting of the Condensed Matter Section, we mainly discuss the high-level aspects of Lab::Measurement necessary to perform highly complex measurement tasks with simple scripts.
Now, the topic of this post is the CPAN release of Lab::Zhinst, which provides a Perl5 interface to devices from Zurich Instruments, a vendor of fast digital lock-in amplifiers, phase-locked loops, arbitrary waveform generators, impedance analyzers, digitizers, and boxcar averagers. There is no doubt about the excellent performance of their hardware. But when it comes to their approach to measurement automation it very much differs from what is commonly provided by Test & Measurement equipment. Let me explain by comparing their proprietary approach to the existing open interfaces. These open interfaces make it possible to control test & measurement equipment with general-purpose programming languages, like Perl, Python, Java, Ruby, Scala, or what have you.
The 19th German Perl Workshop will take place in roughly two months time in Hamburg. The German-speaking Perl Community will meet from the 26th to the 28th of June 2017
in the "Bürgerhaus Wilhelmsburg".
So after
yesterday's
little review I finally got to do some coding on Driver::DBI and the first thing I got working was my '00_load.t' test case. All I needed to do with the present sate of the code is add in;
my $in_hash = {
++ da_compose_only=>1,
view => { name => 'name' }};
to that test case and the error I was getting from DBI;
BD::ExampleP::db prepare failed: Syntax error in select statement ("1") at
went away. Now the error was caused by this sub in Driver::DBI
While we are all looking forward to the Perl Conference in Amsterdam, it is time for the venue committee of the YAPC::Europe Foundation (YEF) to think about the location of the 2018 conference. So if you always wanted to invite the European (and International) Perl Community to your hometown for three days of massive Perl, drop us a line at venue@yapceurope.org.
We are excited to announce The Swiss Perl Workshop 2017. This year the workshop will be held in Villars-sur-Ollon, in the French speaking part of Switzerland. The workshop will be in English.
Please spread the word, register, submit talks, and come enjoy a perl workshop in the mountain air. Oh, there will also be beer/wine/drinks and pizza from the real pizza oven at the GivenGain office (although we need to do a test run first).
Yesterday I summed up what I was up to over the past month or so since I left the Dist-Pen, So tadoy as I am rather sort on time I will just do a quick post-ette on the state of Database::Accessor::Driver::DBI.
Well just for kicks before I revisited any of the Driver::DBI code I re-ran the the very limited test suite of two test case and got a full fail, so I guess every thing is broken.
Looking at the code the first think I noticed was that I have this sub
sub _warn {
my $self = shift;
my ($message) = @_;
warn("Database::Accessor::Driver::DBI: $message ");
}
Which I was using to key of this DA flag 'da_warning' now what I think I will do is hop back to 'Database::Accessor::Roles::Driver' and add this in
Do not ask what Perl can do for you, ask what you can do for Perl!
In my effort to bring the new signature back to older versions of Perl, I'm
maintaining Filter::signatures,
a source filter that simply converts the signatures to the equivalent old-style
Perl code. That filter works surprisingly well for its simplicity and has caused
very little in problems.
This is the third article in a series on CPAN distribution metadata. The first article was a general introduction, and the second article looked at dependencies, and in particular the different phases that you can specify dependencies for (configure, build, runtime, test, and develop). In this article, we'll cover the different types of dependencies and how you combine these with the phases (described in the previous article) to specify the dependencies (or prereqs) for your CPAN distribution.
This article is brought to you by MaxMind, a gold Sponsor for this year's Toolchain Summit, being held next month (May) in Lyon, France. The summit is only possible with the support of our sponsors.
Hello all,
In my first blog post I've announced AI::MXNet, Perl interface to the MXNet machine learning library.
The eight weeks that passed after that were quite fruitful, I've ported whole python's test suite, fixed multiple bugs, added docs, examples, high level RNN interface, Perl API docs has been added to the official MXNet website.
This time I'd like to review in detail three examples from the examples directory.
First one is a simple calculator, a fully connected net that is structured to learn
four basic arithmetic operators: addition, subtraction, multiplication and division.
Second example is a comparison of two different approaches to the task of classification
of handwritten digits, and the third one is an example of LSTM RNN network trained to generate Shakespeare like text.
Here is the image (generated by
Graphviz
) of the calculator network.
The data input is two numbers, that are being routed via two paths; first path is turning the input values into natural logarithms and feeds these into one neuron sized fully connected layer.