Less Moose more Elk

Well back to clean up mode in the old Moose-pen today as I have completed my first round of changes to my Database::Accessor embedded classes. Just taking a quick peed at what might attributes might be missing from my I see that my Predicate is missing something important at least to any logical predicate. That is the ability to add parentheses to a predicate.

Well the way I see it I can just make this a Boolean flag attributes such as 'parentheses' but that takes a good deal of flexibility from the system. So what I am going to go for is two flags one for open and one from close, like this

YAPC::Europe 2016 Call for Speakers Closes July 15th

13615185_1584680458491347_654446141469504407_n.jpg

Hello YAPC-ers,

Deadline seems to be quickly approaching, the Call for Speakers closes July 15th, 2016. But the good news is that you've got plenty of time to submit, prepare your talk && join us in Transylvania,

So come on, share your experience, amaze us with incredible ideas && practices. We want to have our minds blown about what we had never thought could be possible with Perl. We are looking for talks focused on all parts of Perl.

If you’re looking for inspiration, here it comes: hot Perl topics, hot tech topics (not limited to Perl, necessarily), trends & changes, Perl fundamentals, security, networking, testing, devOps, hardware, big data, Internet of Things, crazy hacks && ideas, gadgets && wearables, community talks, marketing or management talks, UI & UX, outreach programs, start-ups or other ideas you might have. Remember, this is YOUR conference!

Sparrowdo automation. Part 2. Dealing with http proxy servers.

This is a next post in Sparrowdo automation series.

The previous one was Installing CPAN packages.

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.

Please delete old releases from your CPAN directory

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:

backpan.perl.org/authors/id/N/NE/NEILB

Moose on the edge

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.

How to Get a CPAN Module Download URL

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.

Read the full article.

Dancer 0.200003 Released

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.

For your convenience, here's the full changelog:

Dist::Zilla - Why you should use @Starter instead of @Basic

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.

Can a Moose Juggle?

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

Sparrowdo automation. Part 1. Installing cpan packages.

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.

$ ssh target.host 
$ cpanm Sparrow
$ yum install curl

Here is simple schema of master -> target hosts interaction:

Perl 5 Porters Mailing List Summary: June 30th - July 5th

Hey everyone,

Following is the p5p (Perl 5 Porters) mailing list summary for the past week. Enjoy!

PRC 2016 - Second Trimester

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 April, I got Dist::Zilla. My PR was the documentation of 'Dist::Zilla::App::Tester', but I never got any comment: https://github.com/rjbs/Dist-Zilla/pull/543

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

Late Night Moose

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;

5 Things I Learned at YAPC

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.

REST API with Mojolicious

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 sandbox

Hi all!

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

On your "master" host:

  • git clone https://github.com/melezhik/sparrowdo-test
  • cd ./sparrow-test/example/dir
  • sparrowdo --host=target-host # see other options in sparrowdo documentation

Basically I have tested it on some ubuntu/centos/debian boxes, if you have any issues let me know ...

Regards.

Alexey

More Than One?

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);
     ...
 

Learning from other/experienced speakers

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.

Perl 5 Porters Mailing List Summary: June 22nd-29th

Hey everyone,

Following is the p5p (Perl 5 Porters) mailing list summary for the past week. Enjoy!

Retraction of Geo::Coder::Geocoder::US

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.

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.