Now to get back on track to what I wanted before I made a little Boo-Boo, So in today's post I am going to have a quick look at Moose and its Coercion abilities. One thing about moose Coercion is it works along with Moose Types so you can't have one without the other.
So lets start wit the Accessor.pm 'View' attribute.
Right now we have this
has View => (
is => 'rw',
isa => 'Object',
);
Which is fine but there is noting stopping my from entering any type of object in there so lets fix that
Back in the day, I wrote Perl 5 module
Number::Denominal that breaks up a number into "units," say, 3661 becomes '1 hour, 1 minute, and 1 second'. I felt it was the pinnacle of achievement and awesome to boot.
Later, I ported that module to Perl 6, and recently I found out that Perl 6
actually has .polymod method built in, which makes half of my cool module entirely useless.
Today, we'll examine what .polymod does and how to use it. And then I'll
talk a bit about my reinvented wheel as well.
Denominated
The .polymod method takes a number of divisors and breaks up its invocant
into pieces:
While playing with docker I created a simple sparrow plugin to install docker engine on Ubuntu Trusty 14.04 (LTS) - https://sparrowhub.org/info/docker-engine . Please let me know if other platform to support you need! ;))
Much of what I do involves retrieving stuff over the HTTP family of protocols.
My go-to solutions are either the APIs of LWP::UserAgent/WWW::Mechanize
or the API of AnyEvent::HTTP, depending on whether I want some kind
of concurrency or not. Since I found Future as a somewhat nicer way of
structuring callback hell a bit differently, I've looked around for a nice
implementation of a HTTP client that works with various backends and maybe
even without a backend.
Well in my last post I made a little boo-boo. Well a few really. I wanted to get rid of my 'View' class as it was the same as my 'Element' class once I stripped out some parts. Unfortunately I discovered that I have to add in a number of other attributes to my 'Element' class which should never be part of the 'View' class. So I am going to backtrack on taking View out and put it back in.
Now my second boo-boo from my last post, I wanted to have first letter upper case names for my Accessor attributes like this
DISCLAIMER: data theft is a serious crime in many jurisdictions. The author does not condone or encourage anyone to break laws. The information provided here is for educational purposes only.
PART I: Anguish: The Invisible Programming Language
You may be familiar with funky esoteric languages like Ook or even Whitespace. Those are fun and neat, but I've decided to dial up the crazy a notch and make a completely invisible programming language!
I named it Anguish and, based on my quick googling, I may be a lone wolf at this depth of insanity. In this article, I'll describe the language, go over my implementation of its interpreter, and then talk about some security implications that come with invisible code.
The Code
Here's an Anguish program that prints Hello World:
If you have been following along you may remember this post, in which I introduced what my API was going to look like. Up till now I had only a few of the basic parts of that list in the in Accessor.pm jsut for quick testing. Now before I add in these new elements into my code I think it is time to review my Accessor.pm and see how I can clean it up before I add the others.
So I started with the 'View' and 'Element' classes, bundled in Accessor.pm and I see that I still have a 'retrieve' sub in each. A few posts ago I gave up the idea of trying to enforce the DAD writers to create these subs so there no reason to have them there at all. So out they go.
[This is a post in my latest long-ass series. You may want to begin at the beginning. I do not promise that the next post in the series will be next week. Just that I will eventually finish it, someday. Unless I get hit by a bus.
IMPORTANT NOTE! When I provide you links to code on GitHub, I’m giving you links to particular commits. This allows me to show you the code as it was at the time the blog post was written and insures that the code references will make sense in the context of this post. Just be aware that the latest version of the code may be very different.]
I search Perl information everyday. I'm Japanese. But I don't know what web site write about Perl. I want the site which I can see Perl latest information.
Personal blog entry is very interesting. But personal don't have power of advertise. Many information by company hide these entries.
I want to read the good Perl entry written by good Perl programmer. I want to find good topics. If anyone don't read the entry, the entry is sad.
Please tweet about Perl for many people to be able to read you entry
"Perl Tweet Timeline news" pick the tweet which contains "perl" or "Perl". If you write your entry and tweet by using English, You inform people your entry through this site.
A while back, I wanted to write a post talking about how Perl 6 lets you use
C libraries without writing any C code. It was cool and clickbaity, but I quickly realized two things: (a) the statement isn't always true; and (b) I'm too ignorant to talk about it without sounding like a moron.
And so has started my
path to re-learn C
(I barely ever used it and it was over a decade ago) and to learn Perl 6's NativeCall in great detail. Oh, and I'll blog about my journey in a series of bite-sized posts. Let's begin!
Use C Libraries Without Writing Any C Code!
NativeCall is one of the
standard modules included with Perl 6 that provides interface to C libraries.
No compilers or -dev versions of the libraries are needed! And this, of
course, means you can use C libraries without writing any C code!
Well in today’s playpen I am going to carry on from my last post and get my new name-space all in order so it looks like a re-factor day today. Some of you may of noticed good number of places where I could use all sorts of Moose goodies to save my self time and typing. For example I could create number of roles for the common attributes across my classes or maybe coercion on some of my attributes. Now might seem like a good time to do that.
Well what I have discovered over the years, and some old salts might agree with me on this, is that it is always prudent to build back to last working instance when doing a re-factoring or re-naming, to keep the changes to a minimum and have a point you can quickly get back to.
Update: I have just received notice that Gary Ashton-Jones, a Sydney Perl Monger and long time email list lurker, has lost his battle with prostate cancer. A terrible loss, especially to his wife and children. He will be missed.
Staples have kindly offered to host us tonight (10th of May) at their offices (Level 5, 163 O'Riordan Street, Mascot NSW). This is their first time hosting so everyone be on your best behavior so we can come back.
Start time: 6:30pm
Its ~4 mins walk to the train station, on street parking is free after 5pm.
• Ivan Wills has offered to speak on his latest project VTide
• Llyod Fouriner will speak (more) on his adventures in perl 6
If you would like to purchase a Sydney PM shirt (pictures at https://www.facebook.com/sydneypm) please let me know sizes asap to ensure i bring enough- although i will have a few sizes for impulse buys. They are $30 each and cover costs around meetup.com.
So today's romp in the playpen I think it is time I picked a name-space and stuck to it!
Well after much snooping about and pondering on my part I and going to try to stick my DA in the 'Database' name-space.
That was actually the easy part was the above the tricky bit is figuring out want goes under it, as something like this DA::SQL->new() is what programers want rather than a rather long winded Database::Accessor::Driver::SQL::Connector->new();
So what to do?
Well the first thing is to come up with a clean name-space statement so here is mine;
The Database::Accessor package and all packages below it (Database::Accessor::*) are reserved for used by Database Accessors. Related modulers and extension will use the Database::AccessorX::* name-space. The name-space Database::Accessor::DAD::* are reserved for Data Accessor Drivers.
This morning I uploaded Test2/Test-Simple combined into the Test-Simple distribution. You can find this distribution HERE for download. This is the result of 2 years of development on the testing infrastructure. See THIS document for important information about upgrading.
Because this is such an important module, and this release is such a big change, I have also prepared extra tarballs for Test2 and Test-Simple that completely revert the merge and bump the version by one. If a showstopper or emergency occurs I can upload them in an instant to put things back to mostly the way they were.
I am not anticipating any big issues with this. There has been a lot of testing with a huge focus on backwards compatibility. That said, nothing is ever completely bug free, specially when it is as big as this. If you find any issues please report them!
Along with this distribution I have released the following distributions as stable (up until now they have been listed as experimental)
GitPrep 2.0 is released at 2016-5-7. GitPrep is portable clone of GitHub. GitPrep work on CGI and own server. GitPrep 2.0 is major version up. It supports Pull request.
Support mail address. you can identify user by mail address.
Adding to user id, you can set user name.
you can set encoding, and diff option(which ignore space) at each project. If you write the setting in config file, you set these settings at project setting page.
Header for reverse proxy is change to X-Forwarded-Proto from X-Forwarded-HTTPS
Needed temporary file is created in gitprep directory. not more depend "/tmp"
GitPrep image and example
The following is GitPrep example URL. This is run as CGI at sakura rental server. If you access the following URL, You can use GitPrep. It support SSL.