In A Simple Mojolicious/DBI Example Joel Berger demonstrates how to build a very simple CRUD web app (well, a CR one anyway) using Mojolicious and DBI. I was impressed at how concise it was, and wondered how my preferred technology stack would compare.
I'm not a fan of template languages, preferring DOM manipulation. And rather than Mojo, I'm using Plack here. Anyway, this is what I came up with...
A friend of mine is learning database administration, but for the first time needs to connect it to a webapp. Having done most of his work in MS Access, he has no idea what a web framework is, nor how one would connect a database to it. To help him learn I wrote up a little application using Mojolicious and SQLite.
The 2012 edition of the YAPC::Brasil will start tomorrow. We will have lots of good subjects being presented covering different areas as big data, open data, data journalism, Perl hacking and bioinformatics. There are already representants from 4 local Perl Mongers groups and from 10 different countries, including Brazil. Check the website for more informations.
WebPub helps install and manage popular web apps. We currently are doing WordPress, Drupal, MODX and phpBB. While the web UI is in PHP (decided before I came onboard) the backend is all Perl.
Some of the major components being used are: Mojolicious, Moose, DBIx::Class and Gearman.
Mojolicious provides the REST interface for the PHP front end and will be used in the near future by at least one other company we are working with. That company will write their client in Ruby.
Moose is used heavily for meta method creation, mapping various before / after 'method' to validation and DB update_or_create and the installer system loads the appropriate role (each app has its own role for things that are app specific - an install of Drupal needs more fixup than WP) at runtime.
DBIx::Class - no explaination needed
Gearman - actual interaction with remote systems happens from workers.
As I read last week's
LWN.net's Announcement Page
(LWN.net is a news site for open-source-related news, formerly standing
for "Linux Weekly News"),
I noticed that there were few if any Perl events featured in its upcoming
events calendar. However, these events appear in
the Perl Weekly, and there are many
upcoming Python events featured in LWN.net.
So, please, if you are organising a Perl-related event (or any other major
open-source event), make sure you put it on
the LWN.net calendar.
This will be just partially about the just ended Italian Perl Workshop in Bologna, because frankly most of the talks I did not not understand, even if I would like to improve my Italian. So why even bother being one of a hand full not Italian?
Conference registration is a mere $100 ($30 for students). There are three tracks, covering everything from beginner topics presented by 10gen staff to advanced, detailed MongoDB presentations by industry leaders. Here's the abstract for my talk:
This talk introduces the features of MongoDB by demonstrating how one can build a simple library application. The talk will cover the basics of MongoDB's document model, query language, and API. In addition, we will learn how to use MongoDB within a typical web application framework.
If you're in Boston and you've never used MongoDB before, or are thinking of trying it out, I'd highly recommend stopping by. The demo application for the talk is written with Mojolicious::Lite and will soon be available on GitHub for you to experiment with.
My last post
introduced Marpa::R2::HTML,
a configurable HTML parser.
By editing
a configuration file,
the user can change
the variant of HTML
being parsed.
The changes allowed are very wide ranging.
The previous post started with simple changes --
the ability to specify the contents of new tags,
and the context in which they can appear.
In this post the changes get more aggressive.
I change the contents of an existing HTML element --
and not just any element, but
one of the HTML's three "structural" elements.
Marpa::R2::HTML allows the configuration file to change
the contents of all pre-existing
elements, with the exception of the highest level of the three
structural elements:
the
<html>
element itself.
I was wondering how you would do string encoding translation in Camomile (the Ocaml Unicode library). Why would you want to do this? Well, for instance, if you get a UTF-16 encoded string and you need to use PCRE on it, which only takes UTF-8 input. This means that you need to translate your string downward so you can match against it.
As Camomile uses functors extensively, you need to know how they work so you can follow the code example below. However, it is fairly straight forward once you get your head around it (it took me a while to figure this out which is why I am putting this here).
Welcome to Perl 5 Porters Weekly, a summary of the email traffic on the
perl5-porters email list. I was in San Francisco this past week at RICON
2012, a conference about distributed systems for developers. It was
organized by Basho who wrote and support the "NoSQL" Riak data
store. I was there mostly in my capacity as an Erlang developer, but
kept a finely tuned ear out for Perl. Unfortunately, there wasn't any
discussion of Perl (or Python for that matter.) Most of the developers there
work on Rails, Scala/Clojure, Erlang or node.js and it was a little
disappointing to my inner Perl nerd that there wasn't much consideration of
implementations outside of these 5 programming languages.
This month's project night focused on Joel Berger's Alien::Base module. The final bugs are either squashed or very close, and we got an introduction to how the whole thing works.
I learned some interesting things about DynaLoader that helped cement the idea that it's an interface on to the system's dynamic linker. I've never dealt with DynaLoader from the Perl side of things, except when it broke, and I would solve those problems in system-specific ways. I learned that DynaLoader could solve those problems in a cross-platform way.
I started writing my own Alien::Base module for libusb, but unfortunately ran out of time. We had some interesting side-discussion on human interface devices and augmented reality.
During a recent trip to Sydney I visited the
Camelot Lounge
. Nothing to do with small children, or arthurian legends, it contains much camel memorabilia. Being a very short train ride (two stops) from the
OSDC venue
, I thought it might be a good place to have a perl gathering as part of the conference. Apologies for poor quality of the the photos below, but you get thie idea. By the way their food is reasonably priced (pizza and pides), and tasty.
Created with Admarket'sflickrSLiDR.
This week we explored another two venues and went to a small vacations: one of the organisers is at his honeymoon and another one goes to YAPC::Brasil. So let's talk a bit about travelling and see the prices to Kiev from different European cities for mid-August 2013, in Euro.
I won't go into the horror stories of people getting yelled at for saying Mojo doesn't support dependencies. Instead, I'll give my opinion on the concept of no dependency, and you could decide for yourself if it relates to Mojolicious or not. I honestly don't care. Obviously, this is not a "don't use Mojolicious" post. In fact, I think it's a cool framework and you should try it out. This post is about my general opinion on the "no dependency" idea. Mojolicious is an example, DBI is another, and there are definitely others (Moose, anyone)?
The whole "NO DEPENDENCY HEAVEN!11" approach to me seems like the PHP "we embedded the code in your HTML!11" approach. Basically, doing something that tries to handle the current situation but in a way that actually ends up counter-productive when technology advances.
I have read several articles, and had several conversations about why people don’t like Mojolicious. I have been meaning to write an article about people’s dislike for Mojolicious for a while now, so I’m going to take this opportinity do so while responding to that article.
Mojolicious is Pro-CPAN
Some people don’t like it claiming that it is “anti-CPAN” and in fact this comes in two flavors. First, they believe that because a tool is available from CPAN that it should be used rather than reimplemented. Second, if one really can reimplement it better, this tool should be forked out of the project and uploaded to CPAN for everyone’s benefit.
While at the Italian Perl Workshop I was talking with a gentleman who does a lot of contract work (and gave me permission to anonymously share this story). Most of his contract work deals with the Web and he's fortunate enough to have worked with quite a few companies who are a bit more sophisticated than the old CGI.pm days. In fact, some of them use Mojolicious, an excellent Web framework that many developers are enjoying. Mojolicious is fast, flexible, robust, and has no CPAN dependencies.
This developer hates working for clients who use Mojolicious. I confess that I was surprised when I found out why. It's an exercise in "unintended consequences".
{
# ... something that needs to be done twice ...
if ( not state $first_iteration_done++ ) {
# ... something that must only happen after the first time ...
redo;
}
}
In general, some form of “if state $flag” can be used as a “have I been here?” idiom that avoids the need to mention the flag’s identifier anywhere else. Without state, one must repeat oneself some distance away at least to declare the flag in whichever outer scope has the appropriate lifetime.
Thank you! Thank you to all who took part in the survey. Your contribution has been greatly appreciated and will help understand better the experience of newcomers in the Perl community.
You can still participate
If you have not filled in the survey yet, there is still time to participate. The survey will be live until October 22 and can be completed by any Perl contributor who joined the Perl community within the last two years.
An older blog post provides some further details about the research project.
Some preliminary results
Here are some of the results drawn from the dataset collected during the first week of the survey.
Number of survey participants:
43 people took part in the survey so far (thank you again). 7 of the 43 people reported to have attended at least one Perl community event and 2 people went through some sort of mentoring while becoming contributors.
We had a bit of downtime on the CPAN Testers last month. Did you notice? I doubt it, as the guys at Bytemark did a wonderful job helping to get us back online. We had a disk failure and with minimal fuss they replaced the disk and had us back up and running within a few days of spotting the problem. Such a far cry from the fiasco of our previous hosting company. Many thanks to all the guys at Bytemark.