My step into what I wood call the world of Moose was actually job related a few years ago and have been happy with it ever since.
One thing in the community I have seen it the rise of other flavors of 'postmodern object system' perl namely the first 'Mouse' and the more recent 'Moo'. Will 'M' will be next? I had some time after bashing in walls and laying wire so I had a look at them.
Both I guess try to solve the same problem mainly the over head of Moose. Mouse drops some parts of moose and redoes others and tries to retain most of Moose's syntax, Moo takes a use only what you need approach so is a little more basic but is much more compatible with Moose.
Both state that they are useful for 'CGI' command line and other simple implementations. To me this begs the question why would you even choose OO design for the above three situations??
v2.0.0 accommodates when the POD (.pod) file is separate from the module (.pm) file. (I gather that this is the case in upcoming Debian.) As I had to modify both pman and podpath for this change, it was easier to just push that functionality into an iterator-generator routine in the pmtools module itself (the first time the pmtools module has contained any useful code.) I only have 1 data point (my consulting PC), but pman and podpath appear to be slightly faster for it.
I bumped the version up to v2.0.0 because of the new dependency on the pmtools module, as well as all of the changes from v1.00 to v2.0.0.
I'm living in Moscow, Russian. Here we have Underground, a rapid transit system. Recently there appeared free WiFi. You just need to connect some WiFi spot, then accept the Licence agreement and you can use Internet.
Yesterday I've opened blogs.perl.org at my mobile phone and here is what I've seen:
At the bottom of the screen the ad has appeared. A small investigation showed that blogs.perl.org is working over http and the WiFi provider changed html and adds that ad.
I don't think that this is ok. Actually I think that this is a horrible business model to change some others sites. But this is the thing that is real and the only way to stop it is to use https.
Actually ssl certificates are very cheep nowadays one year certificate costs less than $10.
So I want blogs.perl.org to work over https. How can I help you with switching to https? I will be very glad to donate the ssl purchase. Where can I transfer money? =)
Well in my last post I found the usefulness of builders when using roles and I quickly found another opportunity to use them about 10 minutes after I finished the post.
Seems I forgot that multi-classed characters are special when it comes to Hit Points (HP).
The rule for their HPs are;
'Roll the appropriate die for each class, add in any constitution bonus, divide by the number of classes rounding up.'
So I now need some sort of way to express this and there are a few things to consider. I could stick it in the '_build_hps' sub of my 'Creator' class and be done with it but then I would have to check somehow if the Character is mutil-class but then I would have to do the same sort of 'if else tree' in my character class if there was only some way it could be one or the other.
Well, actually I'm going to YAPC::NA in Orlando, Florida. That "magic kingdom" place is just a side show by comparison.
This will be my fourth YAPC, and I'm especially excited this year. There have been a lot of advancements in asynchronous programming, meta-object protocols, and web frameworks. So I'm really looking forward to presentations on those.
And of course, there are all the hidden gems that I discover at YAPC -- things I had never expected to learn, but turn out to be incredibly useful or enlightening. Those alone are well worth the expense of attending.
And I always enjoy meeting all the fantastic people who have contributed to Perl::Critic and Pinto over the years. So if you see me, please come up and say "hi". I am pretty easy to spot -- I'm usually the only guy wearing a suit and tie.
It has been a few post since my last full Moose and AD&D post so I though I would get at least one more rule into my 'Creator' Class now that I have may Character Classes and races all sorted out.
This time we are going to look at Hit Points or HP for short.
A touchy subject, for many, as I am sure the black Knight has taken quite a few beyond normal and still fights on.
As well as being the source of endless debate there are also quite a few rules on HPs that are a little tricky to play with. Here are the basics
I find it difficult to review documentation written in a markup language. I need to see that final pretty rendition of it as a manual page, PDF file or HTML web page before I can get a feeling if the thing makes sense. I also like to see that final rendition while I'm writing the document, and switching between the editor and the command line to render the documentation is painful.
Luckily most modern OS's provide a means of monitoring filesystems for changes. I've put together a rather simple bash script which uses Linux's inotify system and App::Pod2CpanHtml to generate HTML output whenever I save a .pod or .pm file. I use Firefox with the Auto Reload plugin to view the files. For grins the script also has an option to pop up a desktop notification when things change, so I know something has happened.
There is a Jaccard Similarity Coefficient routine already in CPAN, but it is specialized for use by Text::NSP. I wanted a generic routine that could be used by anyone so Set::Jaccard::SimilarityCoefficient was born.
The minimum Perl version for Set::Jaccard::SimilarityCoefficient is currently set to 5.8.8, but that needs to be revised because it uses autodie and Test::Most (thereby causing many CPAN Testers failures).
It has been bugging me for a while why my silly little Orignal mod if failing CPAN Testers in all sorts of odd ways. In one version of perl nothing the next something dies and it is just basic code.
Finally had a few mins today and no Idea of what to blog on so I worked on finding the answer.
A few days ago, while migrating my stuff from a soon to be retired host to a new one, I reinstalled a lot of CPAN modules. That's how I found that a dependency of Bot::BasicBot::Pluggable failed its test suite (the migrated box was running the assemble and corelist and meta IRC bots).
The blame for most of what follows can be put on Neil Bowers.
package MyUtils;
use strict;
use warnings FATAL => qw( all );
sub frobnicate { ... }
1;
It passes its test suite, and all is fine and dandy. You use the frobnicate function in a long-running data processing script, and after the first 45 minutes it suddenly dies saying Use of uninitialized value $quux in addition at lib/MyUtils.pm line 13. D'oh!
Back working on the next version of MarpaX::Languages::ECMAScript::AST,
one important missing thing was implementing in Perl the equivalent of JavaScript Regular Expressions Engine.
Despite JavaScript borrowed the perl's syntax,
its semantics behave differently,
and one should never copy a regular expression from Perl into JavaScript blindly.
For instance,
a vicious difference is that a capture value in JavaScript is the last match.
While in Perl this is the last successful match.
Consequence can be hard to track down,
for example,
this regexp:
/(z)((a+)?(b+)?(c))*/
applied on this input:
"zaacbbbcac"
will capture, in JavaScript:
<z> <ac> <a> <undefined> <c>
while perl will say:
<z> <ac> <a> <bbb> <c>
Finally, a nice exercice and the occasion to show what can be achieved with Marpa::R2 Scanless Interface.
ECMAScript specification has a nice writeup of its regular expression grammar and semantics, and it appears that the grammar itself is simple (c.f. the _DATA__ section):
Some of you might remember an earlier post where I was playing about with ARIS Express and created an org chart to map out some of the roles that might be used in my AD&D Character class.
At the end of the post I mused about reading the ARIS file and gleaning out the data I just typed in and generating roles with them. Well I did spend a little time puttering about and even looked at 'FreeMind' and even at a new one called jsULM2. Well all of those where nice but each requires me to do a good deal of fudging to get anything out. Mostly silly little things like calling a UML 'stereotype' or 'multiplicity' a moose role and really It would be confusing to use.
Also had a quick peek on CPAN and found Padre::Plugin::Moose so I had to look at that. After I installed it I found 'Moose Assist' under the Tool menu and it looks like this;
Years ago I created a training class that has proved one of my most enduring, popular...and frustrating: Understanding Perl Regexes.
The class has endured because regexes are still one of the sharpest blades on the Swiss Army Chainsaw, and have consistently become even sharper with almost every major release of Perl, as new features have been added and the underlying implementation has been improved.
The class has been popular because all those powerful added features have also made Perl's regex dialect more complex, more line-noisy, and sometimes just plain scarier than anyone else's. Having someone to guide you though the labyrinth can be invaluable so I've kept looking for ways to help students see beyond the complexity and come to grips with what regexes really are, how they actually work, and how they can be deliberately designed (you know, instead of just metastasizing).
This is part 9 of an ongoing series where I explore my relationship with Perl. You may wish to begin at the beginning.
This week we look at Getting Shit Done.
Last week I pointed out that one reason I stick with Perl is because it keeps evolving, so I never seem to get ahead of it. But that’s not the reason I switched in the first place. And that reason is still just as true today as it was 17 years ago: Perl is the language that Gets Shit Done.
Programming in C++ was fun, and I talked a bit about some things I missed in it. But I also mentioned the big problem with coding in C++: you’re always writing libraries. C++ is a very high-level low-level language. That is, it makes it easy to code just about any data structure or algorithm you can think of. Which is pretty awesome. If you want spend your life coding data structures and algorithms.
Whereas, in Perl, it’s also easy to write all those things ... except that you never have to. ‘Cause, in Perl, they’re already written.
Nothing makes a lazy programmer happier than discovering free software that makes her or his job easier. Here are three of my favorites that I use on the daily:
Devel::SimpleTrace
Devel::SimpleTrace will add stack traces to 'die' and 'warn'.
If you've ever seen library code that you don't recognize throw an error you don't
understand this module should be in your toolkit.
SYNOPSIS
#adapted/copied from the pod
$ perl -MDevel::SimpleTrace program_with_strange_errors.pl
or just put a 'use Devel::SimpleTrace' anywhere.
Basics of reading stacktraces:
Skim from top to bottom.
Stop when you see files that you wrote/recognize, and find the edge between files that are in your control and files that are out of your control.
Work from there outwards until you identify the problem.