A long time ago I posted about Roles without Moose and while I still feel that for most cases Moose is the way to go, there can still be a bit of resistance to the idea. Matt Trout responded to my post with how one could have just roles (read his entire post to understand the context):
package Foo::Manual;
use Moose;
extends 'UNIVERSAL'; # get rid of Moose::Object
with 'Foo::Manual::Bar';
sub new { bless {} => shift }
This still involves putting Moose on your servers and when you're faced with a large dev team that is very conservative in their approach, this might be an uphill battle. So what are my alternatives?
Giving this a try. I have been brought back into Perl world about a couple of years ago, by my old friend Luis Campos (LMC), and I am now writing some of my own modules in Modern (or quasi-) Perl.
yacc
was a
major breakthrough.
For the first time, automatic generation of
of efficient, production-quality parsers was possible
for languages of practical interest.
Yacc-generated parsers had reasonable memory footprints.
They ran in linear time.
But error reporting was overlooked.
Then as now, the focus in analyzing algorithms was on power
-- what kinds of grammar an algorithm can parse --
and on resource consumption.
This leaves out something big.
Our frameworks for analyzing things affect what we believe.
We find it hard to recognize a problem if our
framework makes us unable to articulate it.
Complaints about yacc tended to be kept to oneself.
But while yacc's
overt reputation flourished,
programmers were undergoing an almost Pavlovian
conditioning against it --
a conditioning through pain.
Well, I'm living with my mother, who has Alzheimer's, which is a bit like being out of work, in that I sit around a lot. But I can go out - I just have to lock the front door and garden gate so she doesn't accidently let my 2 miniature dogs out.
Nevertheless, I hope to be still productive in the Perl arena.
So, post frequently, and that'll give me things to read :-).
Absolutely ages ago, I took over maintainership of RTF::Parser. Grand plans abounded, but mostly what I ended up doing was fixing a few of the more outrageous bugs, and made it use the much more sensible RTF::Tokenizer as its back end.
People still use RTF::Parser, and a couple of other modules on CPAN use it, but I really can't give it the love and care it deserves. The code is mildly crazy, there are age-old outstanding bugs on rt ... this Xmas, will you take in a deserving module?
If you've had a look at search.metacpan.org, you may have noticed that some of the author pages have more info than you might find at search.cpan.org. Take, for instance, FREW's author page. You'll see that it has links to his blog, Twitter, StackOverflow, website etc. Lots of information there which allows you to find his various online presences without having to do all too much digging around.
If you'd like to expand your author info, it's pretty easy. We don't have a login for you yet, but this is a trivially easy stop-gap solution to get yourself up and running:
You're writing Perl code in vim and have just typed a package name - maybe you
want to create an object of this class:
some_statement;
my $o = Some::Class->new;
do_something_with($o);
You obviously need to write use Some::Class at the top. So you either move
the cursor near the top and add the line, then jump to the previous line
number, or maybe you split the window, move to the new viewport, make the
change, then close that viewport.
As I promised, here are the slides from my talk this morning at Saint Perl-2 in Saint-Petersburg, Russia.
I believe Morpheus can be very useful for the community and hope that it'll become widely adopted.
There are still a lot of things which can be added, but conceptually we are on the right track.
These slides probably suck (I wrote them in the last moment and didn't put enough details in some places), but putting code out in the wild and getting feedback is more important by now.
One more thing, if you're going to check out PODs in next few days, see them on github instead of CPAN. There are much more of them added in 0.36 release, which is not uploaded to CPAN yet.
UPD: Just found out that 0.36 release docs can be viewed here: http://search.cpan.org/~mmcleric/Morpheus-0.36/
Morpheus::Key, Morpheus::Bootstrap and Morpheus::Plugin::Content PODs are worth to be looking at, if you are interested in implementation detals.
On Twitter, Curtis Poe (@OvidPerl)
posted some
interesting and unintuitive Perl code; I've slightly reformatted it and changed
some values for the sake of the following discussion.
use Data::Dumper;
sub boo { 4,5,6 }
my @x = ( boo() || 5,8,7);
print Dumper \@x;
What do you think this prints?
Let's look at some simpler examples of code:
$ perl -le'@x = (4,5,6,7,8); $y = @x; print $y'
5
An array like @x, in scalar context, evaluates to the number of elements in
that array. In this case, @x contains five elements.