Now in the Moose-pen we are coming to the home stretch of my Database::Accessor Classes, starting with 'Gather'. This one represents a fields in an in SQL 'Group by' clause, and in Mongo 'Group' stage.
Looking at it it really is just an array of predicate clauses so I think I can just drop this class altogether, which is always a good thing. So out it goes and the test as well. So that was easy.
Next it 'Filter' which is a 'Having' clause in SQL and I not 100% sure what it is in Mongo most likely something to do with group and project or maybe match? I guess it is up to the Mongo DAD writer to come up with that one.
Like 'Gather' this is just an array of predicates or the same as my 'Condition' class so I can just drop that one and its tests as well. So that is two classes I do not really need.
Sometimes having internet restricted by http proxy usage could be a problem.
Recalling our latest post on installing CPAN packages, what if we have a server with http traffic only available under some http proxy server? Then we would fail to install any CPAN packages here, and would have a similar error from cpanm client:
$ cpanm CGI
! Finding CGI on cpanmetadb failed.
--> Working on CGI
Fetching http://www.cpan.org/authors/id/L/LE/LEEJO/CGI-4.31.tar.gz ... FAIL
Ok. Passing http proxy is possible when using sparrowdo. Let's get back to the cpan-package plugin.
The Perl NOC have informed the PAUSE admins that the CPAN Master is starting to get tight on diskspace. This is only a temporary constraint — at some point there will be a lot more space, but for now we need to free up some space.
A lot of space is being taken up by old releases, long since superseded. Please delete these old releases if you have some, and the NOC will stop being alerted.
Remember: everything you've ever released to CPAN will always be available in your BackPAN author directory. My PAUSE id is NEILB, so my BackPAN directory is:
Every so often you find yourself requiring the download URL for a CPAN module. You can use the MetaCPAN API to do this quite easily, but depending on your use case, you may not be able to do this in a single query. Well, that's actually not entirely true. Now that we have v1 of the MetaCPAN API deployed, you can test out the shiny new (experimental) download_url endpoint.
The next class in the Moose-pen is Database::Accessor::Link which would represent a 'Join' in SQL and a I think they call it a 'Pipe Lookup' in Mongo or it could mean a find on a document buried under the parent document. I guess that is a topic for a later post.
The first thing I noticed was this class and the 'Condtion' class I looked at yesterday is they share the same 'predicates' attribute. So being a good Mooser the first thing to day is to pull that attribute out and add it into a role.
So after a few copy and pastes and a little typing I have
Dancer 0.200003 is on its way to a CPAN mirror near you. I'd like to give a big shout out to the rest of the Dancer core team and our awesome community members for their work in bringing this release to fruition.
There are several changes in particular worth noting:
- There is a security fix for Dancer2::Session::YAML that prevents accepting a bad session cookie value from the client. Thanks SysPete!
- There was a swift response to the breakage caused by YAML 1.16. Originally, we patched Dancer2 to require a minimum version of 0.86 and a maximum version of 1.15. Thankfully, YAML was patched and updated, and Dancer2 will again work with the latest YAML.pm.
I posted previously about a new "starter" bundle for Dist::Zilla, the CPAN author's automation tool. I'd like to briefly try to answer the question: "Why should I care?"
If you're already happily using Dist::Zilla with an extensive configuration or plugin bundle of your own, this bundle isn't for you. But maybe you can get some ideas from the included plugins, I added a few to my author bundle!
If you're looking to get started in Dist::Zilla, the [@Starter] bundle makes a great starting point. Usage is similar to [@Basic] and all of the same information in the dzil.org tutorial applies.
Here I start a series of posts on sparrowdo configuration management tool usage.
Installing sparrowdo
Sparrowdo implies installing software on both master and target host. Following "push" approach one should install a sparrowdo on master host where from he starts a ssh sessions against target hosts to be configurable:
$ ssh master.host
$ panda install Sparrowdo
Once you install a sparrowdo you need to install a sparrow client on every host where you want to start deployments. Sparrow acts like client to carry out deployment tasks initiated from master host.
In today's Moose-pen we are going to have a look on one of the first my compound Database::Accessor classes 'Database::Accessor::Condition'. By compound I simply mean a class that holds other classes.
The Condition class is just as it sounds a class to add a logical condition to an Accessor. In SQL it would be a 'where' clause and Mongo some of the 'Aggregate' clauses. So basically this is a class that holds a number of 'Predicate' classes. So all I need to add is;
This second semester got me modules owned by well known community members. I expected that to make my life easier, namely to prepare more relevant PRs, but unfortunately it did not work that way.
For May, I got WWW::xkcd. For this I could get an answer about what might be a relevant PR. I added a method to fetch random comic strips. I even got some comments, and I adapted my PR. But it not got merged: https://github.com/xsawyerx/www-xkcd/pull/5
Last week, I attended my very first YAPC (Yet Another Perl Conference) at Orlando. While I feel I can write for pages, I want to talk only about several things, following the newest format "online newspapers" are using.
1) USA is huge.
I remember stories on Quora about tourists who tried to make a day trip to California all the way from New York, and I actually laughed at them too. So I knew the continent is big, I guess I never realized it is "that" big. I was at San Jose, California. I took a flight to Orlando with a stop at Dallas. These were almost 3 hours each. To top it all, Orlando is 3 hours ahead of California, so I also experienced a slight jetlag (not being able to fall asleep even if it's pretty late etc). But we made it safe and sound, so it was fine.
Well today in the Moose-pen I am going to have a look at my Database::Accessor::Parm. Now this is one of the more use full of my classes, This is the one that is used to supply data to a DB query. So in DBI you may have something like this
sub some_sql{
my ($in) = @_;
my $sql = 'SELECT * FROM person where person.id=?'
my $sth -= $dbh->prepare($sql);
my $person = $sth->execute($in);
...
Buidling an API with Mojolicious is fun. Below is an attempt at a very small REST API that outpus the time in JSON. There are several pieces:
Mojolicious::LIte App
App instructions route
Authentication
API routes
Instruction template
We start with a Mojolicious::Lite app that uses three routes and an under. The under is a significant piece, because we use that for the authentication. If the proper HTTP BASIC credentials are passed in, then we continue; if not, we get a error in JSON.
After the under, we have a couple routes that comprise our API. The first supports GET and POST, and will will output a string for the current time. The next one outputs an epoch for given the correct GET request.
Sparrowdo is a new born #perl6 project for configuration management automation. It based on sparrow plugin system.
A user unfamiliar with sparrow or sparrowdo may check out a sparrowdo-test repository containing a ready to use sparrowdo scenarios for some typical cases , like installing packages, checking linux process and so on ...
So to start use it:
install sparrowdo on your "master" host
install sparrow ( vers >= 0.1.11 ) on your "target" host
For this year's London Perl Workshop (LPW) I've suggested that one
of the themes could be "first-time speakers", which means we need to do things
to encourage and help new people to speak.
I've some ideas for how we might do that, and am hoping others will have ideas too.
This post is about one of those ideas.
Well in my last post I added a few new attributes to my Database::Accessor::Element class and when playing about bout today I think I will have to revisit one of them 'aggregate'.
If I just leave it as it is
has 'aggregate' => (
is => 'rw',
isa => 'Str',
);
It will begin to break-down my API as a programmer could come along and enter a very specific Mongo item such as 'mergeObjects' or something odd from an SQL DB like 'DENSERANK' and that makes for a very inconstant API.
So I am just going to bite the bullet and add in a 'Type' for this attribute so lets have a look at that.
Geo::Coder::Geocoder::US is a Perl module that interfaces to the Geocoding API of geocoder.us. Unfortunately that disappeared late 2015. Since this module is therefore useless, I am deleting it from CPAN.
This year I attended my fifth YAPC and, as usual, I’ve decided to reflect a bit on the venue, the talks, and the general mood. Since I just did a (roughly) half-post in my date module series, I figured I’d go ahead and do another (roughly) half-post this week instead of waiting for next week.