XS, Advanced XS Callback Patch For OCI, Part VII Back into 'C' and a little XS

Tonight's installment for my new chapter in XS Fun I am heading back to the 'c' land again looking at the function that actuality sets up the callback.

So now that we have a place to store of callback we can have another quick look at the 'dbd_db_STORE_attrib' function and this little addtion

 
    if (SvTRUE(valuesv)) {
        enable_ha(dbh, imp_dbh);
    } 
   else {
       disable_ha(imp_dbh);
   }

Making git bisect more useful

If you've ever used git bisect, you know what an incredibly useful tool this is. It allows you to do a binary search through commits to find out which commit caused a particular error. Many people seem unaware of git bisect run ... which automates this even further, but it has a limitation: it won't let you find a particular error, it detects success or failure, that's all. So I decided to do something about that.

A Perl CMS for the Masses, Part II

(With permission), I got this email from a former Phoenix.PM-er (my home PM):

I looked at Ruby on Rails, what a mess. I'm running the WordPress meetup group here in Jacksonville Florida...

I've been moving code into Mojolicious lately. Still trying to get used to the "new" ways of doing things.

You have one more "backer" - all the best on this. I can help with documentation at least, if you like.

I was right. I'm not the only Perler who uses WordPress or is responsible for site. In my case, I help with http://biketempe.org as part of my duties on the board of Tempe Bicycle Action Group.

Right now, there are 47 supporters and $1,840 pledged: https://www.kickstarter.com/projects/2083389021/create-perl-competition-to-the-php-content-managem

Perlmodules.net is awesome

Just a heads up that if you're not using perlmodules.net you should check it out.

I use News+ on my android phone to keep up with RSS feeds, so I find it super useful to be able to at a glance find out when modules that I use frequently have been updated, and what's changed.
I got my list of modules I'm following.

**Edited, fixed links to point to unprotected rss feed instead of logged in view, fixed relative to absolute url to perlmodules site.**

XS, Advanced XS Callback Patch For OCI, Part VI Well Not Really Even 'C' but we will see if there is some XS or perl

Another in my seemingly endless posts for a new chapter in XS Fun. Today I am am going to look at just what and where my the functions from my last two posts store their data.

Now to do a little backtracking I hinted earlier on about a mythical 'c' struct called 'imp_dbh_t' and I had mentioned this is where we where storing the values that we where passing into the 'Store' function and getting from the 'Fetch' function.

No not to go all to 'c' on you what you really need to know it that a 'c struct' is just the way 'c' stores a number of variables in memory with one pointer. Working with structures should be second nature to a Perl programmer as you would access the data in a struct with it name or key like this

 
imp_dbh->ha_function

Inheritance is Bad: Code Reuse Part III

0. Overview

  1. Inheritance is Bad: Code Reuse Part I
  2. Inheritance is Bad: Code Reuse Part II
  3. Inheritance is Bad: Code Reuse Part III

1. Introduction

There exists a legend named the Gordian Knot. It was a knot that nobody was able to untie. An oracle predicted that the one who will be able to untie the knot would become the king of Asia. A lot of people tried to untie it, but nobody was successful. It seemed like an impossible task to do. But 333 BC they came a man, when he tried to untie it he drew his sword, sliced the knot and untied it that way. That man was Alexander the Great, and became later the King of Asia.

To the tune of…

Buddy Burden:

Yes, we had multiple keynotes [at YAPC::NA 2014]. Two or three a day, even. I thought that was a bit weird. My friend David Hand kept joking that we had gone beyond keynotes and were now into keychords.

how to sync time between two linux servers

  1. Option 1
  2. Found a way to synchronize date and time with a server over ssh which can quickly solve the problem:

    # date --set="$(ssh user@server date)"

    Or you can do it the other way around:

    # ssh user@host "date --set \"$(date)\""
  3. Option 2
  4. ‘ntpdate 10.200.117.37’ or ‘/usr/sbin/sntp -P no -r 10.200.117.37’ Of course you need to set up a ntp or sntp server first.

Changes to Test::Builder/More/Simple incoming

A couple months back Schwern handed me the keys to Test::Builder and friends. Initially I planned to try and knock out little bugs and simply maintain stability... That plan failed and I ended up spending a lot of time giving it a major overhaul for a feature Schwern and I agreed would be very nice. Result Streaming. This was further prompted by a minor change to a specific diagnostic message that resulted in breaking fragile tests written with Test::Builder ::Tester, which frankly, has seen better days. THERE IS A BETTER WAY!

I have just released an ALPHA version of the Test-Simple dist. This dist includes the following changes and features:

Reboot All The Things - My thoughts on this years YAPC::NA

There is an old saying that "distance makes the heart grow fonder", and watching Matt Trout talking at YAPC::NA this year filled me with the mixed emotions embodied within that saying. I am simultaneously sad that I was not there to correct Matt's swiss cheese memory of past events and happy that I wasn't around to witness his sad excuse for a beard. But alas, this blog post is about much more then Matt's physiology.

Nothing makes me miss all the wonderful folks in the Perl community as not being able to get to YAPC::NA. So while I have not yet watched all of the videos, I did watch the 6 (count them, six!!!) keynotes, and I wanted to just post about my impressions of them.

XS, Advanced XS Callback Patch For OCI, Part V Much More 'C' and just a little XS

Adding some more for the new chapter in XS Fun. Today I am just going to go carry on with the next part of the patch which is very similar overview of the next function that is going to be patched.

Thinking-Cap-no-wait-Hat.jpeg


Now that we fully understand 'dbd_db_STORE_attrib' function we can move on to the next part of our patch and that is updating the 'dbd_db_FETCH_attrib' function so lets look at that in detail

it is expecting only 3 prams

  1. SV *dbh, a pointer to SV 'Scalar Value' that is the current DBI DB Handle
  2. imp_dbh_t *imp_dbh, a pointer to a structure called 'imp_dbh_t' that is used store our value
  3. SV *keysv, a 'SV' pointer to the key for the value

Like the last function the SV are our Perl values while the 'imp_dbh_t' is where in our 'c' code is going to look for the data we are asking for.

So the patch for this function is a little less complex

Planet Moose - June 2014

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.

If you'd like to contribute some news for next month's issue, you can do so on the wiki.

Moose

Moose 2.1208 and 2.1209 have been released containing some minor bugfixes.

Inheritance is Bad: Code Reuse Part II

0. Overview

  1. Inheritance is Bad: Code Reuse Part I
  2. Inheritance is Bad: Code Reuse Part II
  3. Inheritance is Bad: Code Reuse Part III

1. Introduction

My first part about Inheritance was more theory. I explained the problems with Inheritance, and explained how roles can solve some of them. I told that there is even a better way, but instead of going straight to that point i want to first talk about Roles. We first need to understand Roles and which problems Roles still have to go further. Instead of just explaining the problems in theory i also want to add some code, because code always helps a little bit more to understand the problem. So that post even got a little bit longer than i really wanted.

2. Our example

To point out the problems with Roles we should create a little example.

Dist::Zilla as a Continuous Delivery Tool

I just recently converted my IO::Iron  distribution to using Dist::Dilla as a release and build automation  tool. Dist::Dilla is mainly targeted at people writing free software Perl packages for releasing into CPAN (Perl free software archive) but if used properly it can make easier the releasing of any software.

Before


When I started to build the IO::Iron distribution, I already knew of Dist::Zilla but two things kept me from adapting it. Firstly, I considered it too difficult to learn for such a small project (which later grew), and, secondly, being bloated and suffering from featuritis. Instead, I went with the classic solution of using Module::Starter to begin, and continued with manually editing the Makefile.PL and every other file, including MANIFEST, README and Changes. I used my private Subversion repository. I uploaded to CPAN via the CPAN Author page page.

XS, Advanced XS Callback Patch For OCI, Part IV Finally Some Code but no Perl and just a little XS

Adding some more for the new chapter in XS Fun. Today I am just going to go carry on with the first part of the patch but like the title says I don't think there well be any Perl or XS today


So now that we have defined what our patch will fit into the DBI API lets look into how we get our values into our 'c' code.

Well DBD::Oracle, and most DBD for that matter, there is set pattern to get an value from the Perl attribute Hash-Ref and load it into our 'c' code. This is of course mostly due to 'c' language being a very closely typed and strictly structured language so playing about with variables and alike require much more care than your typical Perl mash-up.

So where we have to do this is in dbdimp.c and it has a

Web::Module::CoreList


Web::Module::CoreList - 'This is a web interface for Module::CoreList.'

Very cool and useful website, worth checking out.

As a web developer and perl programmer, I'd like to see ( and build ) more websites like this!

mop problem 5 - Role and C3 searching is not always necessary

I think Role and C3 searching is not always necessary.

Object orientation good practice I want to tell to newbies is single inheritance and delegation.

Role is multiple inheritance. Role can have attributes. This mean role have data, not only methods. I don't think this is good.

I think the reason making mop complex is Role and C3 searching.

If Role and C3 searching are none, BUILD, BUILDARGS, DEMOLISH, $self->next::method, and many complex things is no needed. And overriding new method is easy and $self->SUPER::foo work well.

I don't deny Role and C3. TMTOWTDI is good, but are Role and C3 searching needed as core features?

Answer of comments

Multiple inheritance is bad, yes. But, why? Can you explain? (I don’t mean to me. Just think about it.)

The reason is that diamond inheritances occur in multiple inheritance. A -> B, A -> C, B -> D, C -> D.

Perl Needs a User Friendly CMS


During Lightning Talks at YAPC this year (2014), I stood up and proposed a project: adapt an existing enterprise style CMS (feature complete, mature, but hard to install and not sexy enough) to directly compete with WordPress (easy to install, shiny).

Then I got this amazing piece of email as feedback and just had to share it (with permission, of course):

Scott,

I agree with your hypothesis about the importance of a CMS (or other popular extendable software) to the introduction of a computing language to novice programmers. I am one of those novice programmers. I enjoyed writing perl plugins to the Movable Type platform, but now MT is no longer open source.

I've checked in on WebGUI every couple of months, and was very excited about version 8. Plack support could be a game-changer, how could development stop now?!

Besides Plack/fastcgi, I also would like to see Postgres support.

Good luck. I hope you reach your funding goal. Let me know if there is any other way I can help.

Rick Bychowski

Test::RequiresInternet now on CPAN

During my talk at YAPC I recommended that people writing functional tests for a web service client ensure that Internet access is available before running the rest of the test. Later, a question was asked about an easy way to test for Internet access, and I was informed of the existence of Net::Detect.

With a recent thread from CPAN-workers fresh in my memory, I promised to release Test::RequiresInternet to CPAN during YAPC if I was fortunate enough to get through all of it.

I uploaded Test::RequiresInternet shortly before game night and its available on CPAN (also Github.) I just haven't gotten around to publicizing it a bit until I was back from Florida.

That means you can now write your test like this:

XS, Advanced XS Callback Patch For OCI, Part III The Plan

Adding some more for the new chapter in XS Fun. Today I am just going to go my implimetaion plan of what needs to be changed how that fits into the world of XS

The Plan

The first thing to note about this patch is that there is no change to the Oracle.xs file. Now the reason for this is has been hinted at earlier in the chapter and that is DBD::Oracle is largely a 'C' program that is linked directly with Perl using dynaloader and its bootstrap method.

So we can ignore Oracle.xs in this patch and that leads us to the question what is going to be patched? Well the answer is almost every file but the Oracle.xs as this patch digs very deeply into the guts of DBB::Oracle, and OCI but never fear there is lots of XS work that has to be done as well.

Step 1 The API

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.